nginx 同时启用连个http服务器

配置文件 


#user  nobody;
# multiple workers works !
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  8192;
    # max value 32768, nginx recycling connections+registry optimization = 
    #   this.value * 20 = max concurrent connections currently tested with one worker
    #   C1000K should be possible depending there is enough ram/cpu power
    # multi_accept on;
}


http {
    #include      /nginx/conf/naxsi_core.rules;
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        off;
    #tcp_nopush     on;

    server_names_hash_bucket_size 128;


    client_body_timeout   10;
    client_header_timeout 10;
    keepalive_timeout     30;
    send_timeout          10;
    keepalive_requests    10;


    server {
        listen       80;
        server_name  localhost;

        location / {
          
            root   html;
            index  index.html index.htm;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

     
    }

     server {
        listen       81;
        server_name  localhost;

        location / {
          
            root   html;
            index  index.html index.htm;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

     
    }

}

说明

服务1 :端口为80

nginx 同时启用连个http服务器_第1张图片

服务2:端口为81

nginx 同时启用连个http服务器_第2张图片

80端口服务页面访问

nginx 同时启用连个http服务器_第3张图片

81端口服务页面访问

nginx 同时启用连个http服务器_第4张图片

你可能感兴趣的:(nginx,http,服务器)