参考阿里云官方:
https://help.aliyun.com/zh/ecs/use-cases/manually-deploy-an-lnmp-environment-on-a-centos-8-instance?spm=a2c4g.11186623.0.0.f280e417ivTvJX#section-e2p-4y1-hlt
nginx 配置
server {
listen 80;
server_name xxxx;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
#root /home/www/contrast/public;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
#
location ~ \.php$ {
root /home/www/contrast/public;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}