在nginx.conf下加入这个节点 。 或者在 NGINX安装目录的conf目录下新建一个vhosts目录,用于存放所有的虚拟主机配置,然后在nginx.conf 最下面加入:include vhosts/*.conf;
server {
listen 5000;
server_name localhost;
location / {
root F:\www\df.php.com; #网站文件路径
index index.php;
if ( !-f $request_filename ) {
rewrite ^/(.*)$ /index.php last;#rewrite
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root F:\www\df.php.com;#这个目录自己定
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}