phpstudy切换nginx配置文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29058883/article/details/84189135

nginx.conf

 server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        root   "D:/phpStudy/WWW";
        location / {
            index  index.html index.htm index.php l.php;
           autoindex  off;
                     if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=/$1  last;
          }
        }

        #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   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php(.*)$  {
            fastcgi_pass   127.0.0.1:9000;
            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;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
vhosts.conf

server {
        listen       80;
        server_name  www.yjh001.com phpStudy.net;
        root   "D:/phpStudy/WWW/yjh/website";
        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
          if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=/$1  last;
          }
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            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;
        }
}

猜你喜欢

转载自blog.csdn.net/qq_29058883/article/details/84189135
今日推荐