// A code block
server {
listen 443;
server_name test.cn;
root /var/www/xiangmu/;
location / {
add_header Access-Control-Allow-Origin *;
index index.htm index.html index.php;
#访问路径的文件不存在则重写URL转交给ThinkPHP处理
if (!-e $request_filename) {
rewrite (.*)$ /index.php/$1 last; //index.php 在public 放置 放在最外层就去掉index.php
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php($|/) {
fastcgi_pass unix:/var/run/php/php7.4-fpm.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;
include fastcgi_params;
#下面两句才能真正支持 index.php/index/index/index的pathinfo模式
#fastcgi_split_path_info ^(.+\.php)(.*)$; #添加
#fastcgi_param PATH_INFO $fastcgi_path_info; #添加
#fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
}
ssl on;
ssl_certificate /var/cert/scs1628575301137.crt;
ssl_certificate_key /var/cert/scs1628575301137.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 /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 24h;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
}
|