部署在互聯網上的 SaaS 系統(tǒng),為了避免通過IP訪問受到攻擊,限制僅能通過域名訪問,可以通過 Nginx 進行配置。
具體配置參考如下:
server {
listen 9090 default_server;
server_name _;
return 444;
}
server {
listen 9090;
server_name .xxx.com;
location / {
try_files $uri $uri/ /index.html;
root /opt/app-vue/dist;
index index.html index.htm;
}
location /prod-api/ {
proxy_pass http://localhost:8080/api/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
閱讀原文:原文鏈接
該文章在 2025/9/11 10:25:15 編輯過