fn_b/_env/nginx.conf
2026-02-12 15:42:58 +08:00

79 lines
2.3 KiB
Nginx Configuration File

server {
listen 80;
server_name v2rayfreenode.com; # 保持一致,老弟!
if ($host = v2rayfreenode.com) {
return 301 https://$host$request_uri;
}
return 404;
}
server {
listen 443 ssl;
server_name v2rayfreenode.com; # 统一域名,别搞串了
# --- 统一 Buffer 调优 (s_buffer_config) ---
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
root /www/wwwroot/v2rayfreenode.com/public;
index index.php index.html;
# SSL 配置 (这里没毛病,保持你的 Certbot 引用)
ssl_certificate /etc/letsencrypt/live/v2rayfreenode.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/v2rayfreenode.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# 性能优化 (高标准三剑客)
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Gzip 压缩 (你写的很专业,继续保持)
gzip on;
gzip_static on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/xml+rss;
gzip_vary on;
# --- 静态资源 (s_static_assets) ---
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 365d;
access_log off;
log_not_found off; # 别让日志报错塞满磁盘
add_header Cache-Control "public, no-transform"; # 强制不被运营商劫持修改
add_header X-Is-This-My-Nginx "Yes-s-Hungarian" always;
try_files $uri =404;
}
# --- Laravel 路由 ---
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# --- PHP 处理 (o_php_handler) ---
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php8.5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 360s;
}
# 安全:禁止访问敏感文件
location ~ /\.(?!well-known).* {
deny all;
}
}