nginx配置http跳转https

 

配置至关简单,在配置文件头部加一行,以下:网站

server {
        listen          *:80;//监听80端口
        return          301 https://www.chenruhui.com$request_uri;//须要跳转的网页
}
server {
        listen          443;
        ...//本身网站的配置
}