真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Apache的配置

Apache默認虛擬主機

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比電白網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式電白網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋電白地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。

在虛擬主機配置文件中第一個虛擬主機

vim  vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

#    ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/tmp/123"

ServerName 111.com

保存后

mkdir /tmp/123

chmod 600 /tmp/123

Apache域名301跳轉(zhuǎn)

在虛擬主機配置文件中加入

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

#      RewriteEngine on

RewriteCond %{HTTP_HOST} ^bbb.com

RewriteRule ^/(.*)$ /upload/otherpic67/125221.jpg$" p_w_picpath-request

SetEnvIf Request_URI ".*\.jpg$" p_w_picpath-request

SetEnvIf Request_URI ".*\.png$" p_w_picpath-request

SetEnvIf Request_URI ".*\.bmp$" p_w_picpath-request

SetEnvIf Request_URI ".*\.swf$" p_w_picpath-request

SetEnvIf Request_URI ".*\.js$" p_w_picpath-request

SetEnvIf Request_URI ".*\.css$" p_w_picpath-request

CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/test.com__%Y%m%d_log 86400" combined env=!p_w_picpath-request

2.2 Apache 配置靜態(tài)緩存

修改虛擬主機配置文件

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

ErrorLog "/usr/local/apache2/logs/tset.com-error_log"

SetEnvIf Request_URI ".*\.gif$" p_w_picpath-request

SetEnvIf Request_URI ".*\.jpg$" p_w_picpath-request

SetEnvIf Request_URI ".*\.png$" p_w_picpath-request

SetEnvIf Request_URI ".*\.bmp$" p_w_picpath-request

SetEnvIf Request_URI ".*\.swf$" p_w_picpath-request

SetEnvIf Request_URI ".*\.js$" p_w_picpath-request

SetEnvIf Request_URI ".*\.css$" p_w_picpath-request

CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/test.com__%Y%m%d_log 86400" combined env=!p_w_picpath-request

ExpiresActive on

ExpiresByType p_w_picpath/gif "access plus 1 days"

ExpiresByType p_w_picpath/jpeg "access plus 24 hours"

ExpiresByType p_w_picpath/png "access plus 24 hours"

ExpiresByType txt/ccs "now plus 2 hours"

ExpiresByType application/x-javascript "now plus 2 hours"

ExpiresByType application/javascript "now plus 2 hours"

ExpiresByType application/x-shockwave-flash "now plus 2 hours"

ExpiresDefault "now plus 0 min"

2.3 Apache配置防盜鏈

修改虛擬主機配置文件加上

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

SetEnvIfNoCase Referer "^http://.*\.aaa\.com" local_ref

SetEnvIfNoCase Referer ".*\.bbb\.com" local_ref

SetEnvIfNoCase Referer "^$" local_ref

Order Allow,Deny

Allow from env=local_ref

Apache訪問控制

在虛擬主機配置文件加上

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

AllowOverride None

Order allow,deny

Allow from all

Deny from 1.1.1.1

Apache禁止解析php

在虛擬主機配置文件加上

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

php_admin_flag engine off

Order deny,allow

Deny from all

Apache 禁止指定user_agent

user_agent 搜索引擎

限制了curl 和chrome 瀏覽器訪問

RewriteEngine on                   相當(dāng)于開關(guān)

RewriteCond %{HTTP_USER_AGENT} ^.*curl.* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^.*chrome* [NC]

RewriteRule .* - [F]

Apache通過rewrite限制某個目錄

RewriteEngine on                   相當(dāng)于開關(guān)

RewriteCond %{REQUEST_URI} ^.*/tmp/.* [NC]

RewriteRule .* - [F]

Apache--admin加密

在虛擬主機配置文件加上

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

保存后創(chuàng)建Apache的驗證用戶

/usr/local/apache2/bin/htpasswd -c /data/.htpasswd user

-----------------------------------------------------------------

總配置文件

#     ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/tmp/123"

ServerName 111.com

#     ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/data/www/"

ServerName aaa.com

ServerAlias bbb.com

#     ErrorLog "logs/test2.com-error_log"

#     CustomLog "logs/test2.com_log" combined

ErrorLog "/usr/local/apache2/logs/tset.com-error_log"

SetEnvIf Request_URI ".*\.gif$" p_w_picpath-request

SetEnvIf Request_URI ".*\.jpg$" p_w_picpath-request

SetEnvIf Request_URI ".*\.png$" p_w_picpath-request

SetEnvIf Request_URI ".*\.bmp$" p_w_picpath-request

SetEnvIf Request_URI ".*\.swf$" p_w_picpath-request

SetEnvIf Request_URI ".*\.js$" p_w_picpath-request

SetEnvIf Request_URI ".*\.css$" p_w_picpath-request

CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/test.com__%Y%m%d_log 86400" combined env=!p_w_picpath-request

ExpiresActive on

ExpiresByType p_w_picpath/gif "access plus 1 days"

ExpiresByType p_w_picpath/jpeg "access plus 24 hours"

ExpiresByType p_w_picpath/png "access plus 24 hours"

ExpiresByType txt/ccs "now plus 2 hours"

ExpiresByType application/x-javascript "now plus 2 hours"

ExpiresByType application/javascript "now plus 2 hours"

ExpiresByType application/x-shockwave-flash "now plus 2 hours"

ExpiresDefault "now plus 0 min"

SetEnvIfNoCase Referer "^http://.*\.aaa\.com" local_ref

SetEnvIfNoCase Referer ".*\.bbb\.com" local_ref

SetEnvIfNoCase Referer "^$" local_ref

Order Allow,Deny

Allow from env=local_ref

RewriteEngine on

RewriteCond %{HTTP_HOST} ^bbb.com

RewriteRule ^/(.*)$ http://aaa.com/$1 [R=301,L]

RewriteEngine on

RewriteCond %{REQUEST_URI} ^.*/tmp/.* [NC]

RewriteRule .* - [F]

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

AllowOverride None

Order allow,deny

Allow from all

Deny from 1.1.1.1

php_admin_flag engine off

Order deny,allow

Deny from all

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT} ^.*curl.* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^.*chrome* [NC]

RewriteRule .* - [F]


當(dāng)前文章:Apache的配置
網(wǎng)址分享:http://weahome.cn/article/jhiioo.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部