安装Nginx
成功后
1 2
| systemctl enable nginx systemctl start nginx
|
开启nginx服务。
现在可以打开地址栏输入服务器地址看看是否有Nginx的欢迎画面

默认目录 /usr/share/nginx/html
修改 /etc/nginx/nginx.conf
文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /home/website;
include /etc/nginx/default.d/*.conf;
location / { root /home/website; index index.php index.html index.htm; autoindex on; }
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
|
安装PHP
成功后上传info.php
代码
接着安装php-fpm
1
| sudo yum install php-fpm
|
查找php-fpm
确认位置及版本
我得是php7.4-fpm
启动php-fpm
1
| service php7.4-fpm start
|
确认php-fpm的状态
1
| netstat -lnt | grep 9000
|
如果什么都没有返回,则需要修改php-fpm的配置文件
去/etc/php-fpm.d
Ubuntu的话有时在/etc/php/7.4/fpm/pool.d/
中修改www.conf文件(重点)
1 2
| ;listen = /run/php/php7.4-fpm.sock listen = 127.0.0.1:9000
|
修改权限(重点)
1
| chmod 777 /run/php/php7.4-fpm.sock
|
重新启动php-fpm
1
| service php7.4-fpm restart
|
再次确认php-fpm的状态,这时我们再去确认一下php的页面就可以正常显示了