server
{
listen 80;
listen 443 ssl;
server_name host;
index index.html index.htm index.php;
root /data/public;
ssl_certificate cert/server.crt;
ssl_certificate_key cert/server.key;
#ssl on;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
error_page 497 https://$host$uri?$args;
if ($request_uri ~ (.+?\.php)(|/.+)$ ){
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
location ~ .*\.php.*
{
include php_fcgi.conf;
include pathinfo.conf;
include fastcgi_params;
fastcgi_param HTTPS on; # 多加这一句很重要
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~* \.(ini|sql|conf|bak)$ {
return 404;
}
location ~* ^/(themes|images|logs|data|demo|wap_themes)/.*\.(php|php5)$ {
deny all;
}
location ~ /\.(svn|git|)/ {
deny all;
}
access_log /var/log/nginx/access.log access;
#access_log off;
}
本文档由 Jerry.Chen 维护更新