nginx http 转 https

server{
      listen 80;
      server_name itunic.com www.itunic.com;
      location / {
          rewrite (.*) https://itunic.com$1 permanent;
      }
   }
server {
        listen 443 ssl;
         ssl_certificate ssl/itunic.crt; #证书公钥文件路径
         ssl_certificate_key  ssl/itunic.key;   #证书私钥文件路径
         ssl_session_timeout  5m;  #5分钟session会话保持
         ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
         ssl_ciphers  HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
        root /www/web/itunic_com/public_html;
        server_name itunic.com www.itunic.com;
        index  index.html index.php index.htm;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        location ~ \.php$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                include fcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
                expires      1d;
        }
        location ~ .*\.(js|css|html|htm)?$ {
                expires      12h;
        }
        location ~ /\.ht {
                deny  all;
        }
        access_log  logs/itunic.com_access.log  wwwlogs;
        error_log  logs/itunic.com_error.log;
}
posted @ 2022-11-21 16:00  Star-Hitian  阅读(41)  评论(0编辑  收藏  举报