mirror of
https://github.com/Kori1c/ecs-controller.git
synced 2026-05-10 07:45:50 +08:00
44 lines
1022 B
Nginx Configuration File
44 lines
1022 B
Nginx Configuration File
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;
|
||
}
|
||
} |