SSL配置Thinkphp5.1PathInfo配置及隱藏index文件

server {
  listen 443;
  ssl on;
  server_name cmf.***.cn;
  access_log /wwwlogs/***_nginx.log combined;
  index index.html index.htm index.php;
  root /site/data/**.cn/public;

  #include /usr/local/nginx/conf/rewrite/none.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  ssl_certificate   /usr/local/nginx/**.pem;
  ssl_certificate_key  /usr/local/nginx/**.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;


  location / {
       if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=$1  last;
           break;
       }
    }

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;

    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param   PATH_INFO $fastcgi_path_info;

    fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
    fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;

    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}

1. php.ini 中打開 cgi.fix_pathinfo = 1前面的;去掉。

2.  上面上的配置文件中設置好自己的域名,root路徑, ssl證書的路徑即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章