通过Nginx反向代理,IIS和apache 共用80端口
#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配置就可以了