如何php项目部署到nginx
2022-12-02 09:01:16
187
{{single.collect_count}}

php项目部署到nginx的方法:首先安装“Nginx”和“php-fpm”;然后将项目复制到“nginx/html”文件下;接着修改配置文件;最后重新载入Nginx并启动“php-fpm”即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

推荐:《PHP视频教程

Linux环境使用Nginx部署PHP项目

一、安装Nginx和php-fpm

二、部署项目

①将你的项目复制到该文件下

cd /usr/local/nginx/html

②修改配置文件

cd ../cd confvim nginx.conf#在location / {........}模块的index配置中添加index.php#location ~ \.php$ {.......} 把该模式块的注释全部去掉,并将fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;改为fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
登录后复制

③重新载入Nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf/usr/local/nginx/sbin/nginx-s reload
登录后复制

④启动php-fpm

/usr/local/php/sbin/php-fpm
登录后复制

⑤访问你的项目

以上就是如何php项目部署到nginx的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}