nginx访问http强制跳转https

server {
    listen 80;
    listen [::]:80;

    server_name www.test;

    root /home/zrj/www/zhangrenjie_test;
    index index.php index.html;

    #这里强制跳转到https
    rewrite ^(.*) https://$server_name$1 permanent; 

    location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                # With php-cgi (or other tcp sockets):
                #fastcgi_pass 127.0.0.1:9000;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }
}

本文题目:nginx访问http强制跳转https
文章起源:http://csruizhi.cn/article/jiooop.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 重庆网站建设 成都网站建设 成都网站建设流程 成都网站建设公司 手机网站建设 企业手机网站建设 移动手机网站制作 成都网站设计 做网站设计 四川成都网站设计 手机网站制作 成都网站制作 成都企业网站制作 定制级高端网站建设 成都企业网站设计 成都网站设计 成都营销网站制作 定制网站设计 成都商城网站制作 成都网站建设 专业网站设计 温江网站设计