server {
listen 80;
server_name 127.0.0.1;
location / {
proxy_pass http://ip:port
}
}
根据标识反向代理到不同服务
server {
listen 80;
server_name www.elk.com;
location /kibana/ {
proxy_pass http://ip:5601;
}
location /elasticsearch/ {
proxy_pass http://ip:9200;
}
}
wordpress
upstream wordpress {
server ip;
}
server {
listen 80;
server_name www.wordpress.com;
location / {
proxy_pass http://wordpress;
client_max_body_size 1000m;
proxy_set_header terminal_id $http_terminal_id;
proxy_set_header Host $host:$server_port;
proxy_set_header X_Read_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 静态资源
location ~ .* {
proxy_pass http://wordpress;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}