操作环境:
- 硬件:华为云服务器
- 操作系统:Rocky Linux 9.0 64bit
- 服务器软件:nginx 1.24.0,php 8.2.6,openssl 3.0.7
问题描述
# systemctl status nginx.service
● nginx.service - nginx
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/nginx.service.d
└─php-fpm.conf
Active: active (running) since Tue 2023-05-23 13:22:55 CST; 7min ago
Process: 3108 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 3109 (nginx)
Tasks: 3 (limit: 23205)
Memory: 3.9M
CPU: 67ms
CGroup: /system.slice/nginx.service
├─3109 "nginx: master process /usr/local/nginx/sbin/nginx"
├─3110 "nginx: worker process"
└─3111 "nginx: worker process"
May 23 13:22:55 hecs-288529 systemd[1]: Starting nginx...
May 23 13:22:55 hecs-288529 systemd[1]: Started nginx.
解决方案
- 修改/usr/local/nginx/conf/nginx.conf配置文件。将以下关于php的设置内容,从http server复制到https server中。
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
- 运行指令
sudo systemctl restart nginx.service
,重启nginx服务。
- 再次访问站点,一切OK。
This is a demo advert, you can use simple text, HTML image or any Ad Service JavaScript code. If you're inserting HTML or JS code make sure editor is switched to 'Text' mode.