fix(nginx): remove api. subdomain and revert back to single domain for backend and fronted

This commit is contained in:
2026-05-03 15:33:21 +03:30
parent 9a764fafb4
commit e190825135
2 changed files with 11 additions and 60 deletions

View File

@@ -1 +1 @@
VITE_API_BASE_URL=https://api.qlockify.ir
VITE_API_BASE_URL=https://qlockify.ir

View File

@@ -5,13 +5,6 @@ server {
return 301 https://qlockify.ir$request_uri;
}
server {
listen 80;
server_name api.qlockify.ir;
return 301 https://api.qlockify.ir$request_uri;
}
server {
listen 443 ssl;
http2 on;
@@ -42,58 +35,7 @@ server {
client_max_body_size 100M;
sendfile on;
location /api/ {
return 301 https://api.qlockify.ir$request_uri;
}
location /admin/ {
return 301 https://api.qlockify.ir$request_uri;
}
location /docs {
return 301 https://api.qlockify.ir$request_uri;
}
location /redoc {
return 301 https://api.qlockify.ir$request_uri;
}
location /openapi.json {
return 301 https://api.qlockify.ir$request_uri;
}
location /static/ {
return 301 https://api.qlockify.ir$request_uri;
}
location /media/ {
return 301 https://api.qlockify.ir$request_uri;
}
location / {
proxy_pass http://frontend:80;
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;
}
}
server {
listen 443 ssl;
http2 on;
server_name api.qlockify.ir;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
client_max_body_size 100M;
sendfile on;
# Static and Media files
location /static/ {
alias /usr/share/nginx/html/static/;
expires 30d;
@@ -106,6 +48,7 @@ server {
access_log off;
}
# Protect API Documentation with Basic Auth
location ~ ^/(docs|redoc|openapi.json|api/docs|api/redoc|api/openapi.json|api/v1/docs) {
auth_basic "Restricted API Documentation";
auth_basic_user_file /etc/nginx/.htpasswd;
@@ -147,4 +90,12 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://frontend:80;
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;
}
}