fix(nginx): remove api. subdomain and revert back to single domain for backend and fronted
This commit is contained in:
@@ -1 +1 @@
|
|||||||
VITE_API_BASE_URL=https://api.qlockify.ir
|
VITE_API_BASE_URL=https://qlockify.ir
|
||||||
|
|||||||
@@ -5,13 +5,6 @@ server {
|
|||||||
return 301 https://qlockify.ir$request_uri;
|
return 301 https://qlockify.ir$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name api.qlockify.ir;
|
|
||||||
|
|
||||||
return 301 https://api.qlockify.ir$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
http2 on;
|
http2 on;
|
||||||
@@ -42,58 +35,7 @@ server {
|
|||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
sendfile on;
|
sendfile on;
|
||||||
|
|
||||||
location /api/ {
|
# Static and Media files
|
||||||
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;
|
|
||||||
|
|
||||||
location /static/ {
|
location /static/ {
|
||||||
alias /usr/share/nginx/html/static/;
|
alias /usr/share/nginx/html/static/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
@@ -106,6 +48,7 @@ server {
|
|||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Protect API Documentation with Basic Auth
|
||||||
location ~ ^/(docs|redoc|openapi.json|api/docs|api/redoc|api/openapi.json|api/v1/docs) {
|
location ~ ^/(docs|redoc|openapi.json|api/docs|api/redoc|api/openapi.json|api/v1/docs) {
|
||||||
auth_basic "Restricted API Documentation";
|
auth_basic "Restricted API Documentation";
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
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-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user