用lnmp 1.2搭建好之后,配置按要求配好。。然后有个奇怪的问题:
首页打开貌似正常
http://ss.iwant.pw/
其他页面404 了。
请问这是为什么呢??
nginx的配置文件如下:
server
{
listen 80;
#listen [::]:80;
server_name ss.iwant.pw;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/ss.iwant.pw;
location / {
rewrite ^/(welcome(/index)?|index(\.php)?)/?$ / redirect;
rewrite ^/(.*)/index/?$ /$1 redirect;
if (!-e $request_filename){
rewrite ^/(.+)/$ /$1 redirect;
}
rewrite ^system.* /index.php/$1 break;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 break;
}
}
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
首页打开貌似正常
http://ss.iwant.pw/
其他页面404 了。
请问这是为什么呢??
nginx的配置文件如下:
server
{
listen 80;
#listen [::]:80;
server_name ss.iwant.pw;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/ss.iwant.pw;
location / {
rewrite ^/(welcome(/index)?|index(\.php)?)/?$ / redirect;
rewrite ^/(.*)/index/?$ /$1 redirect;
if (!-e $request_filename){
rewrite ^/(.+)/$ /$1 redirect;
}
rewrite ^system.* /index.php/$1 break;
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 break;
}
}
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}