我的问题是访问主网站:example.com
未指向index.php
,我必须手动输入完整网址example.com/index.php
。
子域sub01.example.com
运行良好,自动指向index.php。
我有3个网站如下:请帮助检查
主站点:example.com
子域名:sub01.example.com,sub02.example.com
这是我的配置:
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
# root directive should be global
root /var/www/example.com/;
index index.php;
access_log /var/www/example.com/logs/nginx_access.log;
error_log /var/www/example.com/logs/nginx_error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
listen 80;
server_name sub01.example.com www.sub01.example.com;
# root directive should be global
root /var/www/sub01.example.com/;
index index.php;
access_log /var/www/sub01.example.com/nginx_access.log;
error_log /var/www/sub01.example.com/nginx_error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
listen 80;
server_name sub02.example.com www.sub02.example.com;
# root directive should be global
root /var/www/sub02.example.com/;
index index.php;
access_log /var/www/sub02.example.com/logs/nginx_access.log;
error_log /var/www/sub02.example.com/logs/nginx_error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
答案 0 :(得分:0)
对不起。
错误来自cloudflare DNS指针配置。