# 配置服务器
server {
# 你监听的端口号
listen 443 ssl;
# 服务器
server_name ***;#此处为你自己的域名
index index.php index.html;
root /usr/local/nginx/html/tp/public;
charset utf-8;
# ssl设置
ssl_certificate /usr/local/nginx/conf/crt/1_***_bundle.crt;
ssl_certificate_key /usr/local/nginx/conf/crt/2_***.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;
#log配置
error_log /usr/local/nginx/logs/***.log;
access_log /usr/local/nginx/logs/***.log;
location / {
index index.php index.html index.htm;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=/$1 last;#伪静态配置
break;
}
#autoindex on;
}
location ~ \.php(.*)$ {
try_files $uri =404;
root /usr/local/nginx/html/tp/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#下面两句是给fastcgi权限,可以支持 ?s=/module/controller/action的url访问模式
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#下面两句才能真正支持 index.php/index/index/index的pathinfo模式
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://www.95app.top/nginx%e9%85%8d%e7%bd%aessl/