专注于Magento开发与外贸SEO推广
Magento主题|Magento插件|Magento教程

Nginx强制http跳转到https

if ($server_port != 443) {
    rewrite (.*) https://$host$1 permanent;
}

使用该代码,可以让不是443端口的跳转到443端口

设置跳转

server {
    if ($host = 'www.magento4you.com' ) {
        rewrite ^/(.*)$ https://www.magento4you.com/$1 redirect;
    }
}

 

Nginx的基本配置

server
     {
         listen 80;
         listen      443 ssl;   //修改后
         server_name  www.magento4you.com;
         location /
            {
              expires      302400s;

              proxy_pass   http://www.magento4you.com/;            
                 }
              #ssl on;    //修改后
              ssl_certificate /usr/local/nginx/conf/server.crt;
              ssl_certificate_key /usr/local/nginx/conf/server.key;
              access_log  /usr/local/nginx/xxxx.log   log_access;

      }

 

 

 

参考 http://nginx.org/en/docs/http/configuring_https_servers.html

未经允许不得转载:Magento|Magento2|magento开发|magento插件|magento主题|magento模板|magento商城|magento维护 » Nginx强制http跳转到https
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Magento开发|Magento咨询QQ283475615

联系我们