1、部署nginx
yum -y install nginx
2、启动nginx
nginx
3、检查是否安装成功
ss -nplt | grep 80
ps aux | grep nginx
部署nginx的详细过程,在前面的文章里有详细的过程。
4、部署php
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install php74-php-xsl php74-php php74-php-cli php74-php-devel php74-php-gd php74-php-pdo php74-php-mysql php74-php-fpm
5、启动php
systemctl start php74-php-fpm
6、检查是否启动成功
ss -nplt | grep 9000
ps aux | grep php
7、nginx关联php
配置之前先备份配置文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
修改配置问价
vim +42 /etc/nginx/nginx.conf
[+42] : 进入配置文件后,光标就在42行处
将下面的语句添加。
index index.php index.html index.htm;
location ~ .php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name; }
8、检查nginx配置文件的语法
nginx -t
9、重新加载配置文件
nginx -s reload
这是平缓加载配置文件,不用重启nginx,也能加载配置文件。
10、探测文件
vim /usr/share/nginx/html/index.php
<?php
phpinfo();
?>
我这个截图是部署项目完之后的截图,并不是测试页面。
11、项目上线
1、上传项目,这次项目用的包,我已经上传,感兴趣的可以下在去部署。
2、tar -xf wordpress-5.9.1-zh_CN.tar.gz
3、cp -r wordpress/* /usr/share/nginx/html/