我不太会描述,看图吧这是我创建的测试域名
配置文件内容如下
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot "/www/wwwroot/www.a.com"
ServerName a29dbc60.www.a.com
ServerAlias www.a.com a.com
errorDocument 404 /404.html
ErrorLog "/www/wwwlogs/www.a.com-error_log"
CustomLog "/www/wwwlogs/www.a.com-access_log" combined
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PHP
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-73.sock|fcgi://localhost"
</FilesMatch>
#PATH
<Directory "/www/wwwroot/www.a.com">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
</VirtualHost>
此时开启ssl后再往里添加更多域名
此时的配置文件内容如下
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot "/www/wwwroot/www.a.com"
ServerName a29dbc60.www.a.com
ServerAlias www.a.com a.com m.a.com b.a.com
errorDocument 404 /404.html
ErrorLog "/www/wwwlogs/www.a.com-error_log"
CustomLog "/www/wwwlogs/www.a.com-access_log" combined
#HTTP_TO_HTTPS_START
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}$1 [L,R=301]
</IfModule>
#HTTP_TO_HTTPS_END
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PHP
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-73.sock|fcgi://localhost"
</FilesMatch>
#PATH
<Directory "/www/wwwroot/www.a.com">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmasterexample.com
DocumentRoot "/www/wwwroot/www.a.com/"
ServerName SSL.www.a.com
ServerAlias a.com www.a.com
errorDocument 404 /404.html
ErrorLog "/www/wwwlogs/www.a.com-error_log"
CustomLog "/www/wwwlogs/www.a.com-access_log" combined
#SSL
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.a.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.a.com/privkey.pem
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder On
#PHP
<FilesMatch \.php$>
SetHandler "proxy:unix:/tmp/php-cgi-73.sock|fcgi://localhost"
</FilesMatch>
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PATH
<Directory "/www/wwwroot/www.a.com/">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php index.html index.htm default.php default.html default.htm
</Directory>
</VirtualHost>
看出啥问题了没?
ServerAlias值80和443都不一致,这样就导致新添加的域名只能访问index.html,目录下的文件都访问不了
我不是很懂apache,试着修复使ServerAlias值一致后
DirectoryIndex值明确写着index.php,访问新添加的域名是只访问index.html不访问index.php
请告诉我要怎么修,谢谢
|
|