91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Apache的配置

發布時間:2020-07-19 17:58:37 來源:網絡 閱讀:357 作者:AM學linux 欄目:網絡管理

Apache默認虛擬主機

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

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

<VirtualHost *:80>

#    ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/tmp/123"

ServerName 111.com

</VirtualHost>

保存后

mkdir /tmp/123

chmod 600 /tmp/123

Apache域名301跳轉

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

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

<IfModule mod_rewrite.c>

#      RewriteEngine on

RewriteCond %{HTTP_HOST} ^bbb.com

RewriteRule ^/(.*)$ https://cache.yisu.com/upload/information/20200310/68/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 配置靜態緩存

修改虛擬主機配置文件

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

<Ifmodule mod_expires.c>

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"

</Ifmodule>

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

<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|png|gif|js|css)">

Order Allow,Deny

Allow from env=local_ref

</filesmatch>

Apache訪問控制

在虛擬主機配置文件加上

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

<Directory />

AllowOverride None

Order allow,deny

Allow from all

Deny from 1.1.1.1

</Directory>

Apache禁止解析php

在虛擬主機配置文件加上

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

<Directory /data/www/data>

php_admin_flag engine off

<filesmatch "(.*)php">

Order deny,allow

Deny from all

</filesmatch>

</Directory>

Apache 禁止指定user_agent

user_agent 搜索引擎

限制了curl 和chrome 瀏覽器訪問

<IfModule mod_rewrite.c>

RewriteEngine on                   相當于開關

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

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

RewriteRule .* - [F]

</IfModule>

Apache通過rewrite限制某個目錄

<IfModule mod_rewrite.c>

RewriteEngine on                   相當于開關

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

RewriteRule .* - [F]

</IfModule>

Apache--admin加密

在虛擬主機配置文件加上

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

<Directory /data/www/admin.php>

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

</Directory>

保存后創建Apache的驗證用戶

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

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

總配置文件

<VirtualHost *:80>

#     ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "/tmp/123"

ServerName 111.com

</VirtualHost>

<VirtualHost *:80>

#     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

<Ifmodule mod_expires.c>

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"

</Ifmodule>

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

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

SetEnvIfNoCase Referer "^$" local_ref

<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|png|gif|js|css)">

Order Allow,Deny

Allow from env=local_ref

</filesmatch>

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{HTTP_HOST} ^bbb.com

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

RewriteEngine on

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

RewriteRule .* - [F]

</IfModule>

<Directory /data/www/admin>

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

</Directory>

<Directory />

AllowOverride None

Order allow,deny

Allow from all

Deny from 1.1.1.1

</Directory>

<Directory /data/www/data>

php_admin_flag engine off

<filesmatch "(.*)php">

Order deny,allow

Deny from all

</filesmatch>

</Directory>

<Directory /data/www/admin.php>

AllowOverride AuthConfig

AuthName "aaaaa"

AuthType Basic

AuthUserFile /data/.htpasswd

require valid-user

</Directory>

<IfModule mod_rewrite.c>

RewriteEngine on

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

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

RewriteRule .* - [F]

</IfModule>

</VirtualHost>


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

台东县| 上饶市| 重庆市| 临泉县| 蓝山县| 南京市| 贡觉县| 桦南县| 崇州市| 永寿县| 崇礼县| 缙云县| 武城县| 中山市| 元谋县| 财经| 烟台市| 孟州市| 平乐县| 老河口市| 桐梓县| 田林县| 余姚市| 孝义市| 城步| 平南县| 东辽县| 华亭县| 郴州市| 鄂伦春自治旗| 琼中| 个旧市| 浦东新区| 广南县| 兴城市| 兴山县| 辛集市| 桐城市| 宁远县| 绥江县| 若羌县|