phpstudy:
server {
listen 80;
server_name www.xianzi321123.net;
root "D:/phpstudy_pro/WWW/www.ian.net/public";
location / {
index index.php index.html error/index.html;
error_page 400 /error/400.html;
error_page 506 /error/506.html;
error_page 507 /error/507.html;
error_page 509 /error/509.html;
error_page 510 /error/510.html;
include D:/phpstudy_pro/WWW/www.itulan.net/public/nginx.htaccess;
autoindex off;
if ( !-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
error_log D:/phpstudy_pro/Extensions/Nginx1.16.1/logs/www.xi23.net_error.log crit;
}
重启nignx。刷新页面即可
宝塔:
1,vhosts文件添加如下代码。
include enable-php-73.conf;
location / {
if ( !-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
2,添加伪静态
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
如果还出现404页面,看看备案没,看看解析成功否,看看php版本