通过IP+端口来访问不同网站
可以在配置nginx.conf里的http下配置两个server即可:
server { listen 81; root /path/to/site1; index index.html index.htm index.php; location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
server { listen 82; root /path/to/site2; index index.html index.htm index.php; location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
本文转载自网络,侵权删。