nginx配置如下 user www www;
server
{ listen 8080;
server_name localhost
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/ts.mimangba.com;
set $wwwroot /home/wwwroot/ts.mimangba.com;
location / {
root $wwwroot;
index index.html index.htm index.php;
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|robots\.txt|static)(.*)$ /index.php/$1 last;
}
location ~ ^(.+\.php)(.*)$ {
root $wwwroot;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/tmp/php-cgi.sock;
include fcgi.conf;
}
}有文件/home/wwwroot/ts.mimangba.com;下info.php 用http://localhost:8080/info.php报404
server
{ listen 8080;
server_name localhost
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/ts.mimangba.com;
set $wwwroot /home/wwwroot/ts.mimangba.com;
location / {
root $wwwroot;
index index.html index.htm index.php;
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|robots\.txt|static)(.*)$ /index.php/$1 last;
}
location ~ ^(.+\.php)(.*)$ {
root $wwwroot;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/tmp/php-cgi.sock;
include fcgi.conf;
}
}有文件/home/wwwroot/ts.mimangba.com;下info.php 用http://localhost:8080/info.php报404
吧你要单独显示的页面都添加到这里面
什么叫单独显示的页面?我写的info.php只是测试的,原来有个phpmyadmin的数据管理,本来好好的,不知道动了哪里了,显示访问所有的页面都报404,但页面是确实存在的
server
{ listen 8080;
server_name localhost
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/ts.mimangba.com;
set $wwwroot /home/wwwroot/ts.mimangba.com;
location / {
root $wwwroot;
index index.html index.htm index.php;
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|robots\.txt|static)(.*)$ /index.php/$ last;
}
location ~ ^(.+\.php)(.*)$ {
root $wwwroot;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/tmp/php-cgi.sock;
include fcgi.conf;
}
}