为了能快速了解并处理您的问题,请提供以下基础信息:
7.9
windows
我用二级域名绑定子目录,为什么html能正常访问,二级域名下面的php页面不解析
但是通过主域名+子目录路径访问这个php页面确能打开。
ssl都解析正常,因为通过主域名访问正常,说明也不存在环境问题,应该问题就出在二级域名的配置上面,改来该去,都不行,想问问帮帮忙
该子目录下面也没有.htaccess文件
主目录下面的.htaccess文件是空的。
比如主域名为:
https://www.abc.com/zs/index.php能正常访问,也能正常解析
但是通过二级域名:
https://zs.abc.com/index.php不能正常访问,直接显示php的源代码
页面都是同一个页面,我也在二级域名启用了以下配置:
# 启用 PHP 模块
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
---------------------------
我主域名相关配置如下:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot "d:/wwwroot/web"
ServerAlias 127.0.0.2 www.abc.com abc.com admin.abc.com
ErrorLog "D:/BtSoft/wwwlogs/127.0.0.2-error.log"
CustomLog "D:/BtSoft/wwwlogs/127.0.0.2-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
#redirect 重定向
IncludeOptional conf/redirect/127.0.0.2/*.conf
#proxy 反向代理
IncludeOptional conf/proxy/127.0.0.2/*.conf
ErrorDocument 404 /404.html
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PHP
Include conf/php/71.conf
#PATH
<Directory "d:/wwwroot/web">
Options FollowSymLinks ExecCGI
AllowOverride All
Require all granted
DirectoryIndex index.php default.php index.html index.htm default.html default.htm
# CORS配置
Header set Access-Control-Allow-Origin "https://abc.com"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header set Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range"
Header set Access-Control-Max-Age "1728000"
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@example.com
DocumentRoot "d:/wwwroot/web"
ServerAlias 127.0.0.2 www.abc.com abc.com
ErrorLog "D:/BtSoft/wwwlogs/127.0.0.2-error.log"
CustomLog "D:/BtSoft/wwwlogs/127.0.0.2-access.log" combined
#redirect 重定向
IncludeOptional conf/redirect/127.0.0.2/*.conf
#proxy 反向代理
IncludeOptional conf/proxy/127.0.0.2/*.conf
ErrorDocument 404 /404.html
#SSL
SSLEngine On
SSLCertificateFile conf/ssl/127.0.0.2/fullchain.pem
SSLCertificateKeyFile conf/ssl/127.0.0.2/privkey.pem
SSLCipherSuite YYGGD+AESGCM:YDGF+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol -All +TLSv1.2
SSLHonorCipherOrder On
#DENY FILES
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
#PHP
Include conf/php/71.conf
#PATH
<Directory "d:/wwwroot/web">
Options FollowSymLinks ExecCGI
AllowOverride All
Require all granted
DirectoryIndex index.php default.php index.html index.htm default.html default.htm
# CORS配置
Header set Access-Control-Allow-Origin "https://abc.com"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header set Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range"
Header set Access-Control-Max-Age "1728000"
</Directory>
</VirtualHost>
---------------------------------------
我的二级域名配置如下:
# 招生处
# 证书路径 D:/BtSoft/panel/vhost/ssl/2/
<VirtualHost *:443>
ServerAdmin webmaster@example.com
DocumentRoot "D:/wwwroot/web/zs"
ServerName zs.abc.com
ServerAlias zs.abc.com
ErrorLog "D:/BtSoft/wwwlogs/zs.abc.com-error.log"
CustomLog "D:/BtSoft/wwwlogs/zs.abc.com-access.log" combined
# SSL配置
SSLEngine On
SSLCertificateFile D:/BtSoft/panel/vhost/ssl/2/zs.abc.com_public.crt
SSLCertificateKeyFile D:/BtSoft/panel/vhost/ssl/2/zs.abc.com.key
SSLCertificateChainFile D:/BtSoft/panel/vhost/ssl/2/zs.abc.com_chain.crt
# 拒绝访问的文件
<Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
Order allow,deny
Deny from all
</Files>
# 路径配置
<Directory "D:/wwwroot/web/zs">
Options FollowSymLinks ExecCGI
AllowOverride All
Require all granted
DirectoryIndex index.php default.php index.html index.htm default.html default.htm
# 启用 PHP 模块
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
</Directory>
</VirtualHost>
按正常讲,php肯定是启用了
|
|