我安装nginx 1.0.0,我安装了/usr/local/nginx1.0.0/。 我尝试修改/usr/local/nginx1.0.0/cont/nginx.conf文件。
我只是复制默认文件。 并replaceserver_name和根path
和我连接example.com – >它的工作(有Nginx的工作信息。)
但是我连接了www.example.com – >它不工作(404 Not Found消息。)
url是= http://www.example.com/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/的index.php / index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/索引。 PHP / index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/
我尝试server_name => example.com * .example.com(但同样的问题)
这是我的nginx.conf代码。 我错了configuration? 或错误的安装?
server { listen 80; server_name .example.com; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME html$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
您是否有任何其他可能与www.example.com匹配更好的server {}块,并覆盖此块?
另外,你可能不想使用fastcgi_index 。 这只在less数不寻常的情况下才有用。 对于像你这样的典型案例,你想要使用类似的东西
try_files $uri $uri/index.html $uri/index.htm $uri/index.php
在你的location / {}块。 最后一项产生一个内部redirect到location ~ \.php$ {}块的位置。