Nginx 將域名下全部http請求轉換爲https請求


# the jtyp http_https-server
server {
    listen       80;
    server_name  jtyp.gdliulan.com;
    rewrite ^(.*) https://$server_name$1 permanent;
}
server {
    listen       443 ssl;
    server_name  jtyp.gdliulan.com;
 
    ssl_certificate      /usr/web/jtyp/2502643_jtyp.gdliulan.com.pem;
    ssl_certificate_key  /usr/web/jtyp/2502643_jtyp.gdliulan.com.key;
 
    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;
 
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;
 
    root    "/usr/web/jtyp";
    location / {
        index  index.html index.htm index.php default.php;
 
        if (!-e $request_filename) {
            rewrite  ^(.*)$  /index.php?s=/$1  last;
        }
       #autoindex  off;
    }
    
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
    
    location ~ \.php(.*)$  {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }
    
}php

相關文章
相關標籤/搜索