解决项目中出现的404 Not Found nginx/1.15.0

1.配置好nginx php环境

运行 sudo nginx

sudo php-fpm

2.将项目放在服务器运行目录中

/usr/local/var/www

3项目为 newdailian

配置好数据库导入数据dailian.sql

解决项目中出现的404 Not Found nginx/1.15.0_第1张图片

4.由于项目是tp3.23框架的 需要配置伪静态

打开配置文件 nginx.conf

配置文件目录为 /usr/local/etc/nginx/nginx.conf

加入这句


location / {
root html/newdailian ; #表示服务器文件根目录 项目放在此目录下面
if (!-e $request_filename) {
rewrite ^/index.php/(.*)$ /newdailian/index.php? s =$1 last
break ;
}
index index.html index.htm index.php ;
}


5重启nginx

sudo nginx -s reload

6.运行 这些 可以看到相关页面

http://localhost:8282/newdailian/index.php?s=index/index/login

解决项目中出现的404 Not Found nginx/1.15.0_第2张图片


解决项目中出现的404 Not Found nginx/1.15.0_第3张图片

解决项目中出现的404 Not Found nginx/1.15.0_第4张图片

解决项目中出现的404 Not Found nginx/1.15.0_第5张图片

你可能感兴趣的:(php)