centos7+nginx搭建php 7.3.5环境
1.第一步:搭建Nginx环境参考这位仁兄:
对PHP 环境server的配置:
我自己改一下:
2.第二步:
server
{
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
location / {
root html;
index index.html index.htm index.php;
}
## 和php 结合
location ~ \.php$
{
root html;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
3. 检查配置是否正确: nginx -t
4.重新加载nginx -s reload
5.mginx存的代码放在/usr/share/nginx/html,假如你写了一个测试文件叫test.php在这。
6.主机或虚拟机可以 访问虚拟机下的ip,加test.php了,如,http://192.168.253.8/test.php