Home >Backend Development >PHP Tutorial >nginx listens on multiple ports 80 and 81

nginx listens on multiple ports 80 and 81

WBOY
WBOYOriginal
2016-07-29 09:12:232629browse

Configure two servers in nginx.conf:

<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); }); });

The above introduces nginx to monitor multiple ports 80 and 81, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn