
server { server_name www.aaa.com; root /data/web/aaa/;
location / { index index.php; try_files $uri $uri/ $uri/index.php /index.php?$args; } location ~* \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
server { server_name www.bbb.com; root /data/web/bbb/;
location / { index index.php; try_files $uri $uri/ $uri/index.php /index.php?$args; } location ~* \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 然后 nginx.conf 载入这两个文件 其他都没动 问下是什么情况?
1 Orzzzz 2016-10-20 12:14:31 +08:00 listen 的端口呐? |
3 ryd994 2016-10-20 13:19:27 +08:00 via Android 那么, error log 说什么呢? |
5 strong>whimsySun 2016-10-20 14:02:00 +08:00 http 都是监听 80 端口, nginx 通过 server_name dispatch |
6 william23 OP @whimsySun 那你的意思是说只能通过 listen 不同的端口来调度我的目录,而不能只用 80 端口来调度是吗? 我指的是同时可以使用哦 |
7 dofy 2016-10-20 14:18:59 +08:00 |
8 liyvhg 2016-10-20 15:51:56 +08:00 可以参考楼上的, Server{}字段可以写多个, 多个 Server 可以 Listen 相同端口, Nginx 通过 ServerName 来区分 |