phpstudy下配置nginx环境

如题,直接上代码

<?php
server {
    listen       80;
    server_name  www.syj.com;//自己定义域名
    error_log  D:/phpStudy/PHPTutorial/nginx/logs/www.syj.com.error.log warn;//生成错误日志

    root   D:/phpStudy/PHPTutorial/WWW/syj/web;//指向地址
    index  index.html index.htm index.php;

    location / {
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;//端口号
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        #fastcgi_param  CI_ENV testing;
        include        fastcgi_params;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   D:/phpStudy/PHPTutorial/nginx/html;
    }
}
?>

猜你喜欢

转载自blog.csdn.net/weixin_41722647/article/details/87920778