Update nginx.conf
Browse files- nginx.conf +41 -7
nginx.conf
CHANGED
|
@@ -1,9 +1,43 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
}
|
|
|
|
| 1 |
+
user nginx;
|
| 2 |
+
worker_processes auto;
|
| 3 |
+
error_log /var/log/nginx/error.log warn;
|
| 4 |
+
pid /var/run/nginx.pid;
|
| 5 |
+
|
| 6 |
+
events {
|
| 7 |
+
worker_connections 1024;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
http {
|
| 11 |
+
include /etc/nginx/mime.types;
|
| 12 |
+
default_type application/octet-stream;
|
| 13 |
+
|
| 14 |
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
| 15 |
+
'$status $body_bytes_sent "$http_referer" '
|
| 16 |
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
| 17 |
+
access_log /var/log/nginx/access.log main;
|
| 18 |
+
|
| 19 |
+
sendfile on;
|
| 20 |
+
keepalive_timeout 65;
|
| 21 |
+
|
| 22 |
+
# 你的反向代理配置
|
| 23 |
+
server {
|
| 24 |
+
listen 7860;
|
| 25 |
+
|
| 26 |
+
location /app1/ {
|
| 27 |
+
proxy_pass http://127.0.0.1:3001/;
|
| 28 |
+
proxy_set_header Host $host;
|
| 29 |
+
}
|
| 30 |
+
location /app2/ {
|
| 31 |
+
proxy_pass http://127.0.0.1:3002/;
|
| 32 |
+
proxy_set_header Host $host;
|
| 33 |
+
}
|
| 34 |
+
location /app3/ {
|
| 35 |
+
proxy_pass http://127.0.0.1:3003/;
|
| 36 |
+
proxy_set_header Host $host;
|
| 37 |
+
}
|
| 38 |
+
location / {
|
| 39 |
+
return 404 "Use /app1, /app2, or /app3\n";
|
| 40 |
+
add_header Content-Type text/plain;
|
| 41 |
+
}
|
| 42 |
}
|
| 43 |
}
|