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;

    client_max_body_size 30M;

    #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;
    #配置网址直接进入tomcat的一个项目,如果配置多个 复制多个server即可
    server {
        listen       80;
        server_name  chaoxiangzu.com www.chaoxiangzu.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
        proxy_pass http://localhost:8080/hengshun-chaoxiangzu/dist/;
        index index.html index.htm;

        #这个必须要配置 不配置可能发生错误
        autoindex off;      

        }

       #js代理相关

      location /js/ {
              proxy_pass http://120.24.216.83:8100/dist/js/;
       }
    }
    

server {
        listen  80;
        server_name www.hhhax.cn  h5.hhhax.cn;

        location / {
            proxy_pass http://localhost:7991/;
                        root /dist/;
                        index  index.html  index.htm  index;
                        autoindex off;
        }


        location /upload/ {

              alias /develop/VIDEO/;
              autoindex on;
        }

   }

 server {
        listen       443 ssl;
        server_name  www.nst.im  nst.im;
        ssl_certificate      /develop/nginx/crt/nst.im.pem;
        ssl_certificate_key  /develop/nginx/crt/nst.im.key;
        #ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers  on;
        location / {
            proxy_pass http://localhost:8089/;

            proxy_set_header    X-Real-IP        $remote_addr;

            proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;

            proxy_set_header    HTTP_X_FORWARDED_FOR $remote_addr;

            root /dist/;
            index  index.html  index.htm  index;
            autoindex off;
        }
    }
    server {
        listen  80;
        server_name  www.nst.im   nst.im;
        rewrite ^(.*) https://$server_name$1 permanent;
        
    }
}

你可能感兴趣的:(nginx 配置)