配置nginx,添加PHP支持

作者: wxfeng 分类: linux 发布时间: 2020-09-09 14:38
server {
listen 80;
server_name sitename.com;
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
root /usr/share/nginx/html/;
try_files $uri $uri/ /index.php$is_args$args;
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;
}
}

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注