nginx配置https之兼容php文件以及ThinkPHP

参考文章:http://blog.csdn.net/rosekissyou/article/details/71104004

修改nginx.conf文件,修改后http{}部分内容为:

 

 

[objc] view plain copy
 
  1. server {  
  2.     listen 443;  
  3.     server_name 47.94.240.163;  
  4.     ssl on;  
  5.     root /data/wwwroot/default/xblog;  
  6.     index index.html index.htm index.php;  
  7.     ssl_certificate   /usr/local/nginx/cert/214180338860322.pem;  
  8.     ssl_certificate_key  /usr/local/nginx/cert/214180338860322.key;  
  9.     ssl_session_timeout 5m;  
  10.     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;  
  11.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;  
  12.     ssl_prefer_server_ciphers on;  
  13.     location / {  
  14.         root /data/wwwroot/default/xblog;  
  15.         index index.html index.htm index.php;  
  16.         if (!-e $request_filename){  
  17. rewrite ^/(.*)$ /index.php?s=$1 last;  
  18. }  
  19. #(thinkphp  rewrite路由重写模式添加这段,否则是普通模式)  
  20.     }  
  21.     location ~ \.php$ {  
  22.         root /data/wwwroot/default/xblog;  
  23.         fastcgi_pass  unix:/dev/shm/php-cgi.sock;  
  24.         fastcgi_index  index.php;  
  25.         fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;  
  26.         fastcgi_param HTTPS on;  
  27.         include fastcgi.conf;  
  28.    }  
  29. }  
posted @ 2018-03-06 14:19  yangchunlong  阅读(645)  评论(0编辑  收藏  举报