求一段nginx的配置。要求根据不同的来路域名,发送到不同的端口去处理。
这一台电脑上既有tomcat也有apache,他俩是没有办法同时享用80端口的。我现在让tomcat用8088,apache用8080,然后让nginx用80,这样ngi...
这一台电脑上既有tomcat 也有 apache,他俩是没有办法同时享用80端口的。我现在让tomcat用8088,apache用8080,然后让nginx用80,这样nginx在收到请求后,根据不同的域名转到8088或8080去处理。 如 http://www.abc.com 转到8088,http://bbs.abc.com转到8080,该如何写nginx的配置文件。跪求,在线等。
分数先上50,回答的好,一定会再加的。 展开
分数先上50,回答的好,一定会再加的。 展开
3个回答
展开全部
http {
upstream www
{
server xxx.xxx.xxx.xxx:8088 max_fails=3 fail_timeout=30s;
}
upstream bbs
{
server xxx.xxx.xxx.xxx:8080 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name www.abc.com;
location / {
index index.html index.php index.jsp index.htm;
proxy_pass http://www;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_connect_timeout 90;
#proxy_send_timeout 90;
#proxy_read_timeout 90;
#proxy_buffers 32 4K;
}
log_format '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'"$server_addr;" "$upstream_addr "';
}
server {
listen 80;
server_name bbs.abc.com ;
location / {
index index.html index.php index.jsp index.htm;
proxy_pass http://bbs;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_connect_timeout 90;
#proxy_send_timeout 90;
#proxy_read_timeout 90;
#proxy_buffers 32 4K;
}
}
}#end of http
upstream www
{
server xxx.xxx.xxx.xxx:8088 max_fails=3 fail_timeout=30s;
}
upstream bbs
{
server xxx.xxx.xxx.xxx:8080 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name www.abc.com;
location / {
index index.html index.php index.jsp index.htm;
proxy_pass http://www;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_connect_timeout 90;
#proxy_send_timeout 90;
#proxy_read_timeout 90;
#proxy_buffers 32 4K;
}
log_format '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'"$server_addr;" "$upstream_addr "';
}
server {
listen 80;
server_name bbs.abc.com ;
location / {
index index.html index.php index.jsp index.htm;
proxy_pass http://bbs;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_connect_timeout 90;
#proxy_send_timeout 90;
#proxy_read_timeout 90;
#proxy_buffers 32 4K;
}
}
}#end of http
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家国内优质海外HTTP代理商,拥有一个庞大的IP资源池,覆盖200多个地区,IP数量大且匿名度高。其优点还包括超高并发、稳定高效、技术服务等特点,同时提供HTTP、HTTPS以及SOCKS5协议支持。此外,Sto...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询