我正尝试在两个端口上配置nginx,例如在端口80和端口81上,但目前还没有运行。这里是什么,我试图做一个例子:如何在多个端口上运行Nginx
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name chat.local.com;
location/{
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_buffering off;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 81;
server_name console.local.com;
location/{
proxy_pass http://127.0.0.1:8888;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_buffering off;
}
}
}
当我尝试运行console.local.com,它显示了从chat.local.com内容。有没有办法让nginx运行在两个端口上?提前致谢!
嗨Cobaco,我完全忘了,我需要用端口访问页81.感谢您指出该点的点。 – Uday 2013-04-25 07:17:05