我正在使用Spring和Docker为reverse_proxy构建Nginx
这是我的配置。
nginx.conf
javac fileName.java
conf.d / default.conf
user proxy;
worker_processes auto;
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 {
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;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include mime.types;
default_type application/octet-stream;
include /home/wertkey/nginx/conf/conf.d/*.conf;
client_max_body_size 200M;
client_header_buffer_size 48k;
server {
listen 7070 default_server;
listen [::]:7070 default_server;
server_name _;
root /usr/share/nginx/html;
location / {
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
docker
server {
listen 7070;
server_name something.com;
proxy_connect_timeout 900s;
proxy_send_timeout 900s;
proxy_read_timeout 900s;
send_timeout 900s;
location ^~ /editor/ {
proxy_pass http://localhost:8081;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
rewrite ^/editor/(/.*)$ $1 break;
}
}
我的spring服务器在7070端口上运行。 我想这样。
但是响应总是返回502 Bad Gateway
我想念什么?