12
iis单ip多域名实现https方法

使用ningx进行反向代理。具体如图

1,修改iis网站端口为其他端口。如把80改为88.

2.下载nginx 。 解压后打开 conf 文件夹


新建文件夹vhost 并修改 nginx.conf 为如下配置:

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;
    sendfile        on;
    keepalive_timeout  65;
    include  vhost/*.conf;
}

然后到vhost文件夹中新建文件 host.conf  写入如下内容:

###如果需要 80端口跳443 就加上
server {
        listen 80;
        server_name www.domain.com;
        index index.html index.htm index.php;
        
        location /
        {
          rewrite ^/(.*)$ https://www.domain.com/$1 permanent; 
          
        }
        
}
###80端口
server {
        listen 443 ssl;
        server_name www.domain.com;  #绑定的域名
        index index.html index.htm index.php;
        ssl on;
        ssl_certificate ../ssl/ssl.crt;  #证书位置
        ssl_certificate_key ../ssl/ssl.key;   #证书位置
        ssl_protocols       tlsv1 tlsv1.1 tlsv1.2;
        ssl_ciphers         high:!anull:!md5;
        
        location /
        {
        proxy_pass http://127.0.0.1:88;  #88就是iis绑定的端口
        proxy_set_header host      $host;
        proxy_set_header x-real-ip $remote_addr;
        proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
        }
}

然后启动ningx  直接点击nginx就启动了。

多个网站就在iis里面开启多个端口 88,89,90,91...

ningx里面的配置 绑定的域名修改,证书修改,proxy_pass 修改