我正在尝试在apache2.4.25中创建多个serveralias。它工作但其中一个serveralias有时显示403 fobidden错误。这是我的apache虚拟配置。
<VirtualHost *:80>
ServerName sajhamanch.com
ServerAlias www.sajhamanch.com
ServerAlias english.sajhamanch.com
ServerAlias webmail.sajhamanch.com
ServerAlias autoconfig.sajhamanch.com
ServerAlias autodiscover.sajhamanch.com
DocumentRoot /home/sajhamanch/public_html
ErrorLog /var/log/virtualmin/sajhamanch.com_error_log
CustomLog /var/log/virtualmin/sajhamanch.com_access_log combined
ScriptAlias /cgi-bin/ /home/sajhamanch/cgi-bin/
ScriptAlias /AutoDiscover/AutoDiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
ScriptAlias /Autodiscover/Autodiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
ScriptAlias /autodiscover/autodiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/sajhamanch/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddType application/x-httpd-php7.0 .php7.0
</Directory>
<Directory /home/sajhamanch/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.sajhamanch.com
RewriteRule ^(.*) https://host.crystalsoft.com.np:20000 [R]
<LocationMatch "^(.*\.php)$">
ProxyPass fcgi://127.0.0.1:9002/home/sajhamanch/public_html
</LocationMatch>
Redirect /mail/config-v1.1.xml /cgi-bin/autoconfig.cgi
Redirect /.well-known/autoconfig/mail/config-v1.1.xml /cgi-bin/autoconfig.cgi
</VirtualHost>
<VirtualHost 139.59.22.58:443>
ServerName sajhamanch.com
ServerAlias www.sajhamanch.com
ServerAlias english.sajhamanch.com
ServerAlias webmail.sajhamanch.com
ServerAlias autoconfig.sajhamanch.com
ServerAlias autodiscover.sajhamanch.com
DocumentRoot /home/sajhamanch/public_html
ErrorLog /var/log/virtualmin/sajhamanch.com_error_log
CustomLog /var/log/virtualmin/sajhamanch.com_access_log combined
ScriptAlias /cgi-bin/ /home/sajhamanch/cgi-bin/
ScriptAlias /AutoDiscover/AutoDiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
ScriptAlias /Autodiscover/Autodiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
ScriptAlias /autodiscover/autodiscover.xml /home/sajhamanch/cgi-bin/autoconfig.cgi
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/sajhamanch/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddType application/x-httpd-php7.0 .php7.0
</Directory>
<Directory /home/sajhamanch/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.sajhamanch.com
RewriteRule ^(.*) https://host.crystalsoft.com.np:20000 [R]
SSLEngine on
SSLCertificateFile /home/sajhamanch/ssl.cert
SSLCertificateKeyFile /home/sajhamanch/ssl.key
SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
####### http2 #########
Protocols h2 http/1.1
######## php fpm link #############
<LocationMatch "^(.*\.php)$">
ProxyPass fcgi://127.0.0.1:9002/home/sajhamanch/public_html
</LocationMatch>
SSLCACertificateFile /home/sajhamanch/ssl.ca
Redirect /mail/config-v1.1.xml /cgi-bin/autoconfig.cgi
Redirect /.well-known/autoconfig/mail/config-v1.1.xml /cgi-bin/autoconfig.cgi
</VirtualHost>
这是我的.htacess
ExpiresActive On
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/bmp "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType text/html "access plus 0 seconds"
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/x-javascript
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "public,max-age=25920000"
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.sajhamanch\.com
RewriteRule ^(.*)$ https://www.sajhamanch.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^english\.sajhamanch\.com
RewriteRule ^(.*)$ https://english.sajhamanch.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^sajhamanch\.com
RewriteRule ^(.*)$ https://www.sajhamanch.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
但是当我访问https://english.sajhamanch.com时,apache有时会向我显示403错误页面。
DNS配置中没有问题。我在所有页面中都有这些元标记
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
可能是什么问题?