我有多个域名注册在服务提供商和托管与nginx的linode。
域名示例为www.example.com (非example.com)
所有的域名都可以很好地使用www,但如果没有它,页面将无法加载。
In curl -I http://example.com it结果
curl: (6) Could not resolve host http://example.com我分别有3个A/AAAA记录
blank IP
mail IP
www IP在我的/etc/nginx/sites-available
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.log;
error_log /var/log/nginx/example.com-error error;
root /var/www/examplecom/public;
index index.html index.php;
location ~ \.php?$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php-main.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(.*)$;
#Prevent version info leakage
fastcgi_hide_header X-Powered-By;
}
}
server {
listen 80;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
}我也尝试过在顶部编写第二个服务器块,但结果相同。
请立即提供指导/帮助。
发布于 2017-04-19 14:20:23
感谢你们的回复。
顺便说一下,当我在linode设置中将我的域名从www.example.com更改为example.com时,这个问题就解决了
https://stackoverflow.com/questions/43466956
复制相似问题