当前位置:论坛首页 > Linux面板 > 求助

apache继续添加域名不完整

发表在 Linux面板2019-2-16 20:44 [复制链接] 0 1210

我不太会描述,看图吧这是我创建的测试域名
1.png
配置文件内容如下
<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后再往里添加更多域名
2.png
此时的配置文件内容如下
<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
请告诉我要怎么修,谢谢
使用道具 举报 只看该作者 回复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

企业版年付运维跟进群

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急问题处理

论坛响应时间:10分钟

问题处理方式:1对1处理(优先)

工作时间:白班:9:00 - 18:00

工作时间:晚班:18:00 - 24:00

立即付费处理

工作时间:09:00至24:00

快速回复 返回顶部 返回列表