feat(DevOps): add nginx reverse proxy

This commit is contained in:
patryk20120 2024-05-15 22:12:34 +02:00
parent 180e204c2d
commit 5b98be1644
No known key found for this signature in database
6 changed files with 92 additions and 8 deletions

30
nginx/conf.d/default.conf Normal file
View file

@ -0,0 +1,30 @@
server {
listen 80;
server_name _;
location /api {
proxy_pass http://perplexica-backend:3001;
include proxy.conf;
}
location /ws {
proxy_pass http://perplexica-backend:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://perplexica-frontend:3000;
include proxy.conf;
}
# If you want to support HTTPS, please uncomment the code snippet below
#listen 443 ssl;
#ssl_certificate ./../ssl/your_cert_file.cer;
#ssl_certificate_key ./../ssl/your_cert_key.key;
#ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
#ssl_prefer_server_ciphers on;
#ssl_session_cache shared:SSL:10m;
#ssl_session_timeout 10m;
}

24
nginx/nginx.conf Normal file
View file

@ -0,0 +1,24 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
client_max_body_size 15M;
include /etc/nginx/conf.d/*.conf;
}

8
nginx/proxy.conf Normal file
View file

@ -0,0 +1,8 @@
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;

1
nginx/ssl/.gitkeep Normal file
View file

@ -0,0 +1 @@