首頁  >  文章  >  後端開發  >  nginx 監聽多個連接埠 80和81

nginx 監聽多個連接埠 80和81

WBOY
WBOY原創
2016-07-29 09:12:232610瀏覽

nginx.conf 中設定兩個server即可:

<code>http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on; 

    keepalive_timeout  <span>65</span>; 

    gzip  on;

    upstream localhost {
        <span>server</span><span>127.0</span><span>.0</span><span>.1</span>:<span>8080</span> max_fails=<span>7</span> fail_timeout=<span>7</span>s;
    }   
    <span>server</span> {
        listen       <span>81</span>; 
        server_name  localhost;
        location / { 
            root html;
            <span>index</span><span>index</span>.html <span>index</span>.htm;
            proxy_pass http:<span>//localhost;</span>
        }   
    }   
    <span>server</span> {
        listen       <span>80</span>; 
        server_name  localhost;

        <span>#charset koi8-r;</span><span>#access_log  logs/host.access.log  main;</span>        location / { 
            root   html;
            <span>index</span><span>index</span>.html <span>index</span>.htm;
            proxy_pass http:<span>//localhost;</span>
        }
    }
}</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介紹了nginx 監聽多個連接埠 80和81,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn