JAVA和Nginx 教程大全

网站首页 > 精选教程 正文

CentOS 7.X 上 安装Nginx+php环境

wys521 2024-10-09 18:26:27 精选教程 21 ℃ 0 评论

wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

3.

yum install nginx

4

systemctl start nginx

5

systemctl enable nginx.service

6.安装php fpm(如果是php5.6,则安装php56w-fpm):

yum install php-fpm


7.需要启动php fpm模式:

service php-fpm start


8.自动启动:

systemctl enable php-fpm.service

9.代码部署:

将代码放到/usr/share/nginx/html下面

10.配置域名:


修改/etc/nginx/conf.d/default.conf

端口号可自定义

将server_name改为目标域名

将location种的的root修改为项目路径

增加这段配置:location ~ \.php$ { root /usr/share/nginx/html/server_admin; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

11.重启ngnix就好了

服务器日志在 /var/log/nginx下

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表