一台机子部署多个网站,我们直接访问ip (外网内网都一样)提示无法访问或404.
因为有多个网站,我们想指定某个网站为IP访问默认的网站,如何操作呢?
解:在Listen ip:port; 这个指令行中,加参数default
这个server段就会是这个ip的默认站点
server { listen 80 default; server_name web.com ; location / { root F:/project/web; index index.html index.htm index.php; autoindex on; } location ~ \.php$ { root F:/project/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }