Skip to content

Commit

Permalink
Add nginx.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
AshurovG committed Dec 15, 2024
1 parent d84d0f8 commit 107a17e
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
upstream facade_app {
server 127.0.0.1:8080;
}

upstream grafana {
server 127.0.0.1:3000;
}

server {
server_name cassette-world.ru www.cassette-world.ru;
client_max_body_size 10M;

location /static/ {
proxy_pass https://cassette.hb.ru-msk.vkcloud-storage.ru/static/;

proxy_set_header Host cassette.hb.ru-msk.vkcloud-storage.ru;
proxy_redirect off;
add_header Cache-Control "public, max-age=31536000";
autoindex on;
}

location /images/ {
alias /home/ubuntu/images/;
add_header Cache-Control "public, max-age=31536000";
autoindex on;
}

location /assets/ {
alias /home/ubuntu/frontend/2024_2_GOATS/public/assets/;
add_header Cache-Control "public, max-age=31536000";
autoindex on;
}

location = /api/room/join {
proxy_pass http://facade_app; # Ваш WebSocket-сервер
proxy_http_version 1.1; # WebSocket требует HTTP/1.1
proxy_set_header Upgrade $http_upgrade; # WebSocket-заголовки
proxy_set_header Connection "Upgrade"; # WebSocket-заголовки
proxy_set_header Host $host; # Проброс оригинального Host
proxy_cache_bypass $http_upgrade; # Отключение кеша для WebSocket
}


location ~ ^/api/ {
proxy_pass http://facade_app;
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;
}

location /grafana {
proxy_pass http://grafana;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location / {
root /home/ubuntu/frontend/2024_2_GOATS/dist;
index index.html;
try_files $uri $uri/ /index.html;
}

listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/cassette-world.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cassette-world.ru/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}


server {
if ($host = www.cassette-world.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot


if ($host = cassette-world.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name cassette-world.ru www.cassette-world.ru;
return 404; # managed by Certbot




}

0 comments on commit 107a17e

Please sign in to comment.