我正嘗試在兩個端口上配置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