初始提交:卡密授权管理系统
This commit is contained in:
commit
59586775c4
202 files changed
+25427
No files matched your search
@@ -0,0 +1,119 @@
|
||||
# ============================================
|
||||
# CardAuth 授权管理系统 - 宝塔Nginx配置
|
||||
# 适用:宝塔面板 > 网站 > 设置 > 配置文件
|
||||
# ============================================
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl http2;
|
||||
server_name your-domain.com;
|
||||
root /www/wwwroot/your-site/public;
|
||||
index index.php index.html;
|
||||
|
||||
# SSL证书配置(宝塔面板自动生成,此处仅供参考)
|
||||
# ssl_certificate /www/server/panel/vhost/cert/your-domain/fullchain.pem;
|
||||
# ssl_certificate_key /www/server/panel/vhost/cert/your-domain/privkey.pem;
|
||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||||
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
|
||||
|
||||
# 访问日志
|
||||
access_log /www/wwwlogs/your-site-access.log;
|
||||
error_log /www/wwwlogs/your-site-error.log;
|
||||
|
||||
# ============================================
|
||||
# 前端静态文件(Vue3构建产物)
|
||||
# ============================================
|
||||
# 将前端 dist 目录内容复制到 public/ 下
|
||||
# 或者使用独立域名部署前端,则不需要以下配置
|
||||
|
||||
# 前端静态资源(非 /api 开头的请求返回 index.html)
|
||||
location / {
|
||||
# 如果后端API和前端同域名,使用以下配置
|
||||
# 先尝试访问静态文件
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# 后端API
|
||||
# ============================================
|
||||
location /api {
|
||||
# PHP处理
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# PHP处理
|
||||
# ============================================
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
# 或使用 unix socket:
|
||||
# fastcgi_pass unix:/tmp/php-cgi-81.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
# 传递Authorization头
|
||||
fastcgi_param HTTP_AUTHORIZATION $http_authorization;
|
||||
|
||||
# 安全:隐藏PHP版本
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# 安全加固
|
||||
# ============================================
|
||||
# 禁止访问敏感文件
|
||||
location ~ /\.(?!well-known) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(env|sql|log|md|gitignore|gitattributes)$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# 禁止访问存储目录
|
||||
location ~* ^/storage/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# 禁止访问配置文件
|
||||
location ~* ^/config/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* ^/routes/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# 隐藏Nginx版本
|
||||
server_tokens off;
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
|
||||
# ============================================
|
||||
# 如果前后端分离部署(前端独立域名)
|
||||
# ============================================
|
||||
# server {
|
||||
# listen 80;
|
||||
# server_name admin.your-domain.com;
|
||||
# root /www/wwwroot/your-admin-frontend;
|
||||
# index index.html;
|
||||
#
|
||||
# location / {
|
||||
# try_files $uri $uri/ /index.html;
|
||||
# }
|
||||
#
|
||||
# location /api {
|
||||
# proxy_pass http://api.your-domain.com;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
# }
|
||||
Reference in new issue
Block a user