天天看点

window下phpstudy的nginx配置虚拟主机

打开目录 nginx-conf

server {
         listen       80;

         server_name  www.restfulapi.com/;      //自己配置的虚拟域名

         root   "E:/phpstudy/WWW/restfulapi/restful";//写到你指向的最终rewrite地址

         location / {

             index  index.html index.htm index.php;

             #autoindex  on;

             if ($request_filename !~ (static|robots/.txt|index/.php.*)) {

                 rewrite ^/(.*)$ /index.php?$1 last;

                 break;

                 }



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

         }

}      
127.0.0.1 www
127.0.0.1 www.restfulapi.com
 127.0.0.1 www.api.com
 192.168.1.103 oatest1.com      

继续阅读