nginx配置 多域名 spring boot项目,同台服务器多个端口

2017-02-20

  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 #
 35 server { 
 36 server_name vrspring.com; 
 37 listen 80; 
 38 access_log off; 
 39 index index.html index.htm index.jsp;
 40 
 41 location / { 
 42 client_max_body_size 100m; 
 43 client_body_buffer_size 128k; 
 44 proxy_send_timeout 300; 
 45 proxy_read_timeout 300; 
 46 proxy_buffer_size 4k; 
 47 proxy_buffers 16 32k; 
 48 proxy_busy_buffers_size 64k; 
 49 proxy_temp_file_write_size 64k; 
 50 proxy_connect_timeout 30s; 
 51 proxy_pass http://localhost:8089; 
 52 proxy_set_header Host $host; 
 53 proxy_set_header X-Real-IP $remote_addr; 
 54 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
 55 } 
 56 }
 57 
 58 server { 
 59 server_name m.vrspring.com; 
 60 listen 80; 
 61 access_log off; 
 62 index index.html index.htm index.jsp;
 63 
 64 location / { 
 65 client_max_body_size 100m; 
 66 client_body_buffer_size 128k; 
 67 proxy_send_timeout 300; 
 68 proxy_read_timeout 300; 
 69 proxy_buffer_size 4k; 
 70 proxy_buffers 16 32k; 
 71 proxy_busy_buffers_size 64k; 
 72 proxy_temp_file_write_size 64k; 
 73 proxy_connect_timeout 30s; 
 74 proxy_pass http://localhost:8090; 
 75 proxy_set_header Host $host; 
 76 proxy_set_header X-Real-IP $remote_addr; 
 77 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
 78 } 
 79 }
 80 
 81 
 82 # server {
 83 # listen 80;
 84 # server_name localhost;
 85 
 86 #charset koi8-r;
 87 
 88 #access_log logs/host.access.log main;
 89 
 90 # location / {
 91 # root html;
 92 # index index.html index.htm;
 93 # }
 94 
 95 #error_page 404 /404.html;
 96 
 97 # redirect server error pages to the static page /50x.html
 98 #
 99 # error_page 500 502 503 504 /50x.html;
100 # location = /50x.html {
101 # root html;
102 # }
103 
104 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
105 #
106 #location ~ \.php$ {
107 # proxy_pass http://127.0.0.1;
108 #}
109 
110 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
111 #
112 #location ~ \.php$ {
113 # root html;
114 # fastcgi_pass 127.0.0.1:9000;
115 # fastcgi_index index.php;
116 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
117 # include fastcgi_params;
118 #}
119 
120 # deny access to .htaccess files, if Apache's document root
121 # concurs with nginx's one
122 #
123 #location ~ /\.ht {
124 # deny all;
125 #}
126 # }
127 
128 
129 # another virtual host using mix of IP-, name-, and port-based configuration
130 #
131 #server {
132 # listen 8000;
133 # listen somename:8080;
134 # server_name somename alias another.alias;
135 
136 # location / {
137 # root html;
138 # index index.html index.htm;
139 # }
140 #}
141 
142 
143 # HTTPS server
144 #
145 #server {
146 # listen 443 ssl;
147 # server_name localhost;
148 
149 # ssl_certificate cert.pem;
150 # ssl_certificate_key cert.key;
151 
152 # ssl_session_cache shared:SSL:1m;
153 # ssl_session_timeout 5m;
154 
155 # ssl_ciphers HIGH:!aNULL:!MD5;
156 # ssl_prefer_server_ciphers on;
157 
158 # location / {
159 # root html;
160 # index index.html index.htm;
161 # }
162 #}
163 
164 }