nginx - 가상 도 메 인 이름과 다 중 포트 감청 및 설정 및 nginx 명령

22143 단어 전단
nginx 명령
설정 이 올 바른 지 검증: nginx - t Nginx 버 전 번호 보기: nginx - V 시작 Nginx: start nginx 빠 른 정지 또는 닫 기 Nginx: nginx - s stop 정상 정지 또는 닫 기 Nginx: nginx - s quit 프로필 수정 다시 불 러 오기 명령: nginx - s reload
nginx 설정
#user  nobody;
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  1024;
}


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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       82;
        server_name  localhost;
        root D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        #error_page   500 502 503 504  /50x.html;
        #location = /50x.html {
        #    alias   E:/aaa2
        #}

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

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


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

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


    server {
        listen       80;
        server_name  dq.aaa.cn;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
                proxy_pass    http://10.100.66.255:9007;
                proxy_redirect default ;              

        } 
      }

    #server {
        #listen       80;
        #server_name  www.aaa.cn;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        #location / {
                #proxy_pass    http://127.0.0.1:8081;
                #proxy_redirect default ;              

        #}
      #}

   server {
        listen       80;
        server_name  psjs.aaa.cn;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location /dq {
                alias   E:/psjs.aaa.cn-static/dq;
        #root   E:/td-sail-js;
                index  index.html index.htm;         

        } 
        location /scripts {
                alias   E:/psjs.aaa.cn-static/dq/scripts;
        }

        location /images {
                alias   E:/psjs.aaa.cn-static/dq/images;
        #root   E:/td-sail-js;
                index  index.html index.htm;         

        } 
      }

     server {
        listen       80;
        server_name  js2.aaa.cn;
        #root E:/aaa2/js.aaa.cn;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   E:/psjs.aaa.cn-static;
            index  index.html index.htm;
        }
    location /images {
            alias   E:/psjs.aaa.cn-static/images;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        #error_page   500 502 503 504  /50x.html;
        #location = /50x.html {
        #    alias   E:/aaa2
        #}

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
}

MP 설정 방식 nginx. conf
#     
#   : nginx
#   : nginx -s reload
#   : nginx -s stop

# 1   +           。 nginx                     。       

#       ,windows         
#user  benny staff;
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  1024;
}

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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
    gzip_vary on;

    #     localhost      ,     d:/wwwroot
    server {
        listen       90;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;


        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # include vhosts/*.conf; #  vhosts        
    include vhosts/cardloan.dev.com.conf;

    autoindex on; #  nginx      
    autoindex_exact_size off; #     KB    
    autoindex_localtime on; #                


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

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


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

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

}

vhost.conf
#        ?
# 1、         
# 2、  root ,          
# 3、  nginx -s reload          
server {
    listen  82;
    server_name  cardload.dev.com;
    root   D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;
    index  index.html index.htm;

    error_page   500 502 503 504  /50x.html;

    location ~ /.ht {
        deny  all;
    }
}

인터넷 에서 찾 은 카드 dev. com. conf
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;
        }
    }
}

좋은 웹페이지 즐겨찾기