IIS 同IP只能安装一个证书, 在不更换原有运行环境的情况下安装多个证书,可以使用nginx作为前端反向代理IIS。
1 .Nginx设置教程
nginx下载地址 http://nginx.org/en/download.html
server {
listen 80;
listen 443 ssl;
server_name https66.com;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_certificate /opt/ssl/yourdomain.com.crt;
ssl_certificate_key /opt/ssl/yourdomain.com.key;
ssl_prefer_server_ciphers on;
#自动跳转到HTTPS (可选)
if ($server_port = 80) {
rewrite ^(.*)$ https://$host$1 permanent;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
优化缓存静态文件
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
2. 需要将IIS站点端口修改成8080