e2

滴滴侠,fai抖

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

1.nginx.conf配置

nginx的简单配置,nginx.conf文件:

 

  1. #user  nobody;  
  2. worker_processes  1;  
  3.   
  4. #error_log  logs/error.log;  
  5. #error_log  logs/error.log  notice;  
  6. #error_log  logs/error.log  info;  
  7.   
  8. #pid        logs/nginx.pid;  
  9.   
  10.   
  11. events {  
  12.     worker_connections  1024;  
  13. }  
  14.   
  15.   
  16. http {  
  17.     include       mime.types;  
  18.     default_type  application/octet-stream;  
  19.   
  20.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  21.     #                  '$status $body_bytes_sent "$http_referer" '  
  22.     #                  '"$http_user_agent" "$http_x_forwarded_for"';  
  23.   
  24.     #access_log  logs/access.log  main;  
  25.   
  26.     sendfile        on;  
  27.     #tcp_nopush     on;  
  28.   
  29.     #keepalive_timeout  0;  
  30.     keepalive_timeout  65;  
  31.   
  32.     #gzip  on;  
  33.       
  34.     upstream wms.50yc.com{  
  35.         server localhost:8090;  
  36.     }  
  37.     upstream yxwms.50yc.com{  
  38.         server localhost:8077;  
  39.     }  
  40.       
  41.     server {  
  42.         listen       80;  
  43.         server_name  wms.50yc.com;  
  44.   
  45.         location / {  
  46.             index index.html;  
  47.             proxy_pass http://wms.50yc.com;  
  48.         }  
  49.   
  50.         error_page  404              /404.html;  
  51.   
  52.         error_page   500 502 503 504  /50x.html;  
  53.         location = /50x.html {  
  54.             root   html;  
  55.         }  
  56.     }  
  57.   
  58.     server {  
  59.         listen       80;  
  60.         server_name  yxwms.50yc.com;  
  61.   
  62.         location / {  
  63.             index index.html;  
  64.             proxy_pass http://yxwms.50yc.com;  
  65.         }  
  66.   
  67.         error_page  404              /404.html;  
  68.   
  69.         error_page   500 502 503 504  /50x.html;  
  70.         location = /50x.html {  
  71.             root   html;  
  72.         }  
  73.     }  
  74.   
  75.   
  76.   
  77.     # another virtual host using mix of IP-, name-, and port-based configuration  
  78.     #  
  79.     #server {  
  80.     #    listen       8000;  
  81.     #    listen       somename:8080;  
  82.     #    server_name  somename  alias  another.alias;  
  83.   
  84.     #    location / {  
  85.     #        root   html;  
  86.     #        index  index.html index.htm;  
  87.     #    }  
  88.     #}  
  89.   
  90.   
  91.     # HTTPS server  
  92.     #  
  93.     #server {  
  94.     #    listen       443 ssl;  
  95.     #    server_name  localhost;  
  96.   
  97.     #    ssl_certificate      cert.pem;  
  98.     #    ssl_certificate_key  cert.key;  
  99.   
  100.     #    ssl_session_cache    shared:SSL:1m;  
  101.     #    ssl_session_timeout  5m;  
  102.   
  103.     #    ssl_ciphers  HIGH:!aNULL:!MD5;  
  104.     #    ssl_prefer_server_ciphers  on;  
  105.   
  106.     #    location / {  
  107.     #        root   html;  
  108.     #        index  index.html index.htm;  
  109.     #    }  
  110.     #}  
  111.   
  112. }  


 

2.真实案例访问地址

物联云仓:http://wms.50yc.com/

客户环境:http://yxwms.50yc.com/admin.html

注:由于真实服务的原因所以上面涉及到的host都改成了localhost(实际上公网IP也是可以被解析出来的,还是不贴IP为妙)。


 

 

参考说明:

http://www.nginx.cn/76.html

 

posted on 2017-10-30 01:59  纯黑Se丶  阅读(212)  评论(0)    收藏  举报