Apache 的管理及优化web_apache load 优化,月薪30K

Deny from All

验证


#ip黑名单#
<Directory “/var/www/html/westos”>
        Order Allow,Deny
        Allow from All        
        Deny from 172.25.254.1

验证

#2.基于用户认证#
vim /etc/httpd/conf/httpd.conf
<Directory “/var/www/html/westos”>
        AuthUserfile /etc/httpd/htpasswdfile            ##指定认证文件
        AuthName “Please input your name and password”        ##认证提示语

AuthType basic                        ##认证类型
        Require user admin                    ##允许通过的认证用户 2选1
        Require valid-user                    ##允许所有用户通过认证 2选1

htpasswd -cm /etc/httpd/htpasswdfile admin            ##生成认证文件
注意:
当/etc/httpd/htpasswdfile存在那么在添加用户时不要加-c参数否则会覆盖源文件内容

七、Apache的虚拟主机

mkdir -p /var/www/westos.com/{news,linux}
echo “linux’s page” >/var/www/westos.com/linux/index.html
echo “news’s page” > /var/www/westos.com/news/index.html
echo “default’s page” > /var/www/html/index.html

vim /etc/httpd/conf.d/Vhost.conf
<VirtualHost _default_:80>
    DocumentRoot “/var/www/html”
    CustomLog logs/default.log combined

<VirtualHost *:80>
    ServerName wenku.westos.com
    DocumentRoot “/var/www/westos.com/wenku”
    CustomLog logs/wenku.log combined

<VirtualHost *:80>
    ServerName news.westos.com
    DocumentRoot “/var/www/westos.com/news”
    CustomLog logs/news.log combined

测试:
在浏览器所在主机中
vim /etc/hosts
172.25.254.101 www.westos.com wenku.westos.ocm news.westos.com

firefox http://www.westos.com
firefox http://wenku.westos.com
firefox http://news.westos.com

八、Apache的语言支持

#php#
vim /var/www/html/index.php

<?php     phpinfo(); ?>

dnf install php -y
systemctl restart httpd
firefox http://172.25.254.101/index.php

#cgi#
mkdir /var/www/html/cgidir
vim /var/www/html/cgidir/index.cgi

chmod +x index.cgi   给执行权限
#!/usr/bin/perl
print “Content-type: text/html\n\n”;
print date;

vim /etc/httpd/conf.d/Vhost.conf

<Directory “/var/www/html/cgidir”>
    Options +ExecCGI
    AddHandler cgi-script .cgi
    

firefox http://192.168.0.11/cgidir/index.cgi


#wsgi#

vim /var/www/html/wsgidir/index.wsgi

def application(env,start_response):
        start_response(‘200 OK’,[(‘Content-Type’,‘text/html’)])
        return[b"hello world"]

chmod +x index.wsgi

vim /etc/httpd/conf.d/Vhost.conf

<VirtualHost *:80>
    serverName wsgi.westos.com
    WSGIScriptAlias / /var/www/html/wsgidir/index.wsgi

dnf install python3-mod_wsgi.x86_64

systemctl restart httpd

验证:

九、Apache的加密访问

##安装加密插件
dnf install mod_ssl -y


##生成证书

openssl genrsa -out /etc/pki/tls/private/www.westos.com.key      2048    #生成私钥

openssl req -new -key /etc/pki/tls/private/www.westos.com.key \
-out /etc/pki/tls/certs/www.westos.com.csr                ##生成证书签名文件

openssl x509  -req -days 365 -in  \
/etc/pki/tls/certs/www.westos.com.csr \
-signkey /etc/pki/tls/private/www.westos.com.key \
-out /etc/pki/tls/certs/www.westos.com.crt                #生成证书

x509 证书格式
-req 请求
-in 加载签证名称
-signkey    /etc/pki/tls/private/www.westos.com.key

生成证书签名文件

生成证书

vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
    ServerName login.westos.com
    RewriteEngine on
    RewriteRule ^(/.*)$ https://%{HTTP_HOST}$1

<VirtualHost *:443>
    ServerName login.westos.com
    DocumentRoot “/www/westos.com/login”
    CustomLog logs/login.log combined
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/www.westos.com.crt
    SSLCertificateKeyFile /etc/pki/tls/private/www.westos.com.key

systemctl restart httpd
^(/.*)$        ##客户地址栏中输入的地址
%{HTTP_HOST}    ##客户主机
$1        ##RewriteRule后面跟的第一串字符的值

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)
img

5jLC0H4J-1712646363986)]
[外链图片转存中…(img-M3feLFB7-1712646363987)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)
[外链图片转存中…(img-l1gdDHTu-1712646363987)]

  • 18
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值