您的位置:首页 > 运维架构 > 反向代理

通过Nginx反向代理,IIS和apache 共用80端口

2015-10-28 11:04 731 查看
#user  nobody;
worker_processes  1;

#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 {
include       mime.types;
default_type  application/octet-stream;

#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;

keepalive_timeout  300;
client_max_body_size 128M;
server_names_hash_bucket_size 64;
#gzip  on;

server {
listen 80;
server_name   support.abc.com;
location / {
proxy_pass   http://localhost:82; }
}

server {
listen 80;
server_name abc.com;
location / {

proxy_pass   http://localhost:81; 
}

}
server {
listen 80;
server_name  www.abc.com;
location / {

proxy_pass   http://localhost:81; 
}

}
log_format  main  '$remote_addr -$upstream_addr- $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
}


把IIS和apache 设置不同端口,然后用上面的Nginx配置就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: