nginx 监听多个端口 80和81

来源:互联网 发布:access转sqlserver 编辑:程序博客网 时间:2024/06/05 01:13

nginx.conf 中配置两个server即可:

http {    include       mime.types;    default_type  application/octet-stream;    sendfile        on;     keepalive_timeout  65;     gzip  on;    upstream localhost {        server 127.0.0.1:8080 max_fails=7 fail_timeout=7s;    }       server {        listen       81;         server_name  localhost;        location / {             root html;            index index.html index.htm;            proxy_pass http://localhost;        }       }       server {        listen       80;         server_name  localhost;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {             root   html;            index  index.html index.htm;            proxy_pass http://localhost;        }    }}
2 0