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

时间:2023-03-08 23:59:24
通过Nginx反向代理,IIS和apache 共用80端口
#user  nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} 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 ;
client_max_body_size 128M;
server_names_hash_bucket_size ;
#gzip on; server {
listen ;
server_name support.abc.com;
location / {
proxy_pass http://localhost:82;
}
} server {
listen ;
server_name abc.com;
location / { proxy_pass http://localhost:81; } }
server {
listen ;
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配置就可以了