nginx中配置代理转发
nginx中配置代理转发,redis端口转发
·
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://app-api:8080/;
}
#配置代理转发
location /wechat/ {
proxy_pass http://app-api:8080/wechat/;
}
location /por/ {
proxy_pass http://10.0.4.14:9000/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
stream {
#配置redis端口转发, 对外端口9001转到内部6379端口
upstream redis {
server 10.0.4.14:6379 max_fails=3 fail_timeout=30s;
}
server {
listen 9001;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass redis;
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)