86 lines
2.5 KiB
Nginx Configuration File
86 lines
2.5 KiB
Nginx Configuration File
server {
|
|
listen 8080;
|
|
server_name canina.ir stage.canina.ir localhost;
|
|
|
|
# Security Headers
|
|
server_tokens off;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
|
|
# Main Application (Next.js)
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
}
|
|
|
|
# Uploads Static Files
|
|
location /uploads {
|
|
proxy_pass http://__BACKEND_HOST__:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
client_max_body_size 50M;
|
|
}
|
|
|
|
# Backend API
|
|
location /api {
|
|
proxy_pass http://__BACKEND_HOST__:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
client_max_body_size 50M;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
server_name admin.canina.ir stageadmin.canina.ir;
|
|
|
|
root /app/admin_static;
|
|
index index.html;
|
|
|
|
# Security Headers
|
|
server_tokens off;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
|
|
# SPA routing for Admin Panel
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Uploads Static Files for Admin
|
|
location /uploads {
|
|
proxy_pass http://__BACKEND_HOST__:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
client_max_body_size 50M;
|
|
}
|
|
|
|
# Backend API for Admin
|
|
location /api {
|
|
proxy_pass http://__BACKEND_HOST__:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
client_max_body_size 50M;
|
|
}
|
|
}
|