Nginx一个ip上多站点80、433http、https共存设置
同一服务器ip如果多个独立域名既要80 http访问,又要443https访问。
要让https和http并存,不能在配置文件中使用ssl on,配置listen 443 ssl;
实例
server
{
listen 168.104.102.52:80;
listen 168.104.102.52:443 ssl;
server_name www.iamle.com;
index index.html index.htm index.php;
root /home/wwwroot/www.iamle.com/;
#ssl on; 这里要注释掉
ssl_certificate /usr/local/nginx/conf/www_iamle_com.crt;
ssl_certificate_key /usr/local/nginx/conf/www_iamle_com.key;
#以下配置省略
}
这种方式对seo貌似不友好,更多详细http 转https 设置参考https://www.cnblogs.com/kevingrace/p/6187072.html