jsserver {
listen 80;
server_name dwload.iftballs.com;
if ($host ~ "dwload.iftballs.com$") {
rewrite ^/(.)$ https://dwload.iftballs.com/ permanent;
}
}
server
{
listen 127.0.0.1:8454 ssl http2;
server_name dwload.iftballs.com;
ssl_certificate '/www/server/panel/vhost/cert/dwload.iftballs.com/fullchain.pem';
ssl_certificate_key '/www/server/panel/vhost/cert/dwload.iftballs.com/privkey.pem';
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_timeout '64m';
#index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/dwload.iftballs.com/download;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 8454){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
# 强制清除缓存(新增配置项)
proxy_cache_purge on;
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-74.conf;
#PHP-INFO-END
location /
{
root /www/wwwroot/dwload.iftballs.com/download;
if ($request_filename ~* ^.*?\.(html|doc|pdf|zip|docx|txt|conf|gz|xz|rar|sql)$) {
add_header Content-Disposition attachment;
add_header Content-Type application/octet-stream;
}
sendfile on; # 开启高效文件传输模式
autoindex on; # 开启目录文件列表
autoindex_format html;
autoindex_exact_size on; # 显示出文件的确切大小,单位是bytes
autoindex_localtime on; # 显示的文件时间为文件的服务器时间
charset utf-8,gbk;
# 可选:增加安全性
# deny all; # 禁止所有访问
# allow 192.168.1.0/24; # 仅允许特定网段访问
}
# 可选:增加访问日志和错误日志
access_log /www/wwwlogs/dwload.iftballs.com.log;
error_log /www/wwwlogs/dwload.iftballs.com.error.log;
}
本文作者:Kevin@灼华
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!