Files
ecs-controller/docker/nginx.conf
2026-01-18 19:19:08 +08:00

44 lines
1022 B
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html;
# 日志输出到 stdout/stderr由 Docker 收集
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
# 处理前端路由
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# 处理 PHP 请求
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# 安全配置:禁止访问 .ht* 文件
location ~ /\.ht {
deny all;
}
# 安全配置:严禁外部直接访问 SQLite 数据库文件及 data 目录
location ^~ /data/ {
deny all;
return 403;
}
# 禁止访问 git 文件
location ~ /\.git {
deny all;
}
# 禁止访问 composer 文件
location ~ /composer\.(json|lock) {
deny all;
}
}