一台機子部署多個網站,我們直接訪問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; } }
