nginx配置
TCP转发代理
stream {
# 统一放置,方便管理
# include tcpConf/*.conf;
# 访问8080/tcp将会直接转发到2324/tcp
upstream tcp_proxy {
server 127.0.0.1:2324;
}
server {
listen 8080;
proxy_connect_timeout 8s;
proxy_timeout 24h;
proxy_pass tcp_proxy;
}
}
http代理,根据域名分发
#访问 webdav.gwkang.top/abc 将转发到 http://127.0.0.1:8088/webdav/abc
server {
listen 80;
server_name webdav.gwkang.top;
location / {
proxy_pass http://127.0.0.1:8088/webdav;
}
}
域名转跳
# 放在 http{} 中, 访问 gwkang.top 转跳到 www.gwkang.top
server {
listen 80;
server_name gwkang.top;
rewrite "^/(.*)$" http://www.gwkang.top/$1 break;
}