e2

滴滴侠,fai抖

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

demo:

#user  nginx;  
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  'remoteaddr−remote_user [timelocal]"request" '  
    #                  'statusbody_bytes_sent "$http_referer" '  
    #                  '"httpuseragent""http_x_forwarded_for"';  
  
    #access_log  logs/access.log  main;  
  
    sendfile        on;  
    #tcp_nopush     on;  
  
    #keepalive_timeout  0;  
    keepalive_timeout  65;  
  
    #gzip  on;  
    

    upstream web-server{  
        server localhost:3000;  
    }  


    upstream cms-server{  
        server localhost:8080;  
    }  

    
    server {  
        listen       80;  
        server_name  bbs.mosnowiot.com;

        location / {  
            index index.html;  
            proxy_pass http://web-server;  
        }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        proxy_pass http://web-server;
        expires 30d;
        root /usr/local/bin/www/bbs/static;
    }

    location ~ .*\.(js|css)?$ {
        proxy_pass http://web-server;
        expires 12h;
        root /usr/local/bin/www/bbs/static;
    }
  
        error_page  404              /404.html;  
  
        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   html;  
        }  
    }  
  

    server {
        listen 80;
        server_name m.bbs.mosnowiot.com;
        rewrite ^(.*)$ http://bbs.mosnowiot.com/m  permanent; 
    }


    server {
        listen 80;
        server_name yaoqing.mosnowiot.com;
        
        location / {
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://cms-server;
        }

#    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
#        proxy_pass http://cms-server;
#        expires 30d;
#        root /usr/local/bin/apache-tomcat-8.0.47/webapps/cms;
#    }

#    location ~ .*\.(js|css)?$ {
#        proxy_pass http://cms-server;
#        expires 12h;
#        root /usr/local/bin/apache-tomcat-8.0.47/webapps/cms;
#    }
  
        error_page  404              /404.html;  
  
        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   html;  
        }  
    }


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

 

posted on 2018-01-06 18:35  纯黑Se丶  阅读(147)  评论(0编辑  收藏  举报