server {
client_max_body_size 50M;
listen 443 ssl;
server_name xxx.xxxx.com;
#ssl on;
root /root;
index api.php index.html index.htm;
ssl_certificate /etc/nginx/cert/xxx.xxxx.com.pem;
ssl_certificate_key /etc/nginx/cert/xxx.xxxx.com.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;
if (!-e $request_filename) {
rewrite ^(.*)$ /api.php$1 last;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.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;
}
error_page 500 502 503 504 /50x.html;
}
server {
listen 80;
server_name xxx.xxxx.com;
rewrite ^(.*)$ https://$host$1 permanent;
}
原文:https://www.cnblogs.com/muzitoutou/p/13081898.html