Created
May 12, 2022 11:55
-
-
Save ed-parsadanyan/71422b3614a6814445ddd82b9541f196 to your computer and use it in GitHub Desktop.
Example of NGINX configuration that works together with the docker-compose.yml setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { worker_connections 1024; } | |
http { | |
sendfile on; | |
upstream n8n { | |
server n8n:5678; | |
} | |
# USE THIS TO RE-ROUTE MAIN DOMAIN | |
server { | |
listen 80; | |
server_name maindomain.com; # CHANGE ME | |
server_tokens off; | |
location / { | |
return 301 https://somewhere-else.com; # SET TO DESIRED SSL PORT (1/3) | |
} | |
} | |
# N8N SETUP - force SSL connection | |
server { | |
listen 80; | |
server_name sub-n8n.domain.com; # CHANGE ME | |
server_tokens off; | |
location / { | |
return 301 https://$host:443$request_uri; # SET TO DESIRED SSL PORT (1/3) | |
} | |
location /.well-known/acme-challenge/ { | |
root /var/www/certbot; | |
} | |
} | |
# NOCODB SETUP - force SSL connection | |
server { | |
listen 80; | |
server_name sub-nododb.domain.com; # CHANGE ME | |
server_tokens off; | |
location / { | |
return 301 https://$host:443$request_uri; # SET TO DESIRED SSL PORT (1/3) | |
} | |
location /.well-known/acme-challenge/ { | |
root /var/www/certbot; | |
} | |
} | |
# N8N SETUP - main config | |
server { | |
listen 443 ssl; # SET TO DESIRED SSL PORT (2/3) | |
server_name sub-nododb.domain.com; # CHANGE ME | |
access_log /var/log/nginx/n8n.access.log; | |
error_log /var/log/nginx/n8n.error.log error; | |
ssl_certificate /etc/letsencrypt/live/sub-nododb.domain.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/sub-nododb.domain.com/privkey.pem; | |
include /etc/letsencrypt/options-ssl-nginx.conf; | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | |
error_page 497 https://$host:443$request_uri; # SET TO DESIRED SSL PORT (3/3) | |
location / { | |
proxy_pass http://n8n; | |
proxy_set_header Connection ''; | |
proxy_http_version 1.1; | |
chunked_transfer_encoding off; | |
proxy_buffering off; | |
proxy_cache off; | |
} | |
} | |
# NOCODB SETUP - main config | |
server { | |
listen 443 ssl; # SET TO DESIRED SSL PORT (2/3) | |
server_name sub-nododb.domain.com; # CHANGE ME | |
access_log /var/log/nginx/nocodb.access.log; | |
error_log /var/log/nginx/nocodb.error.log error; | |
ssl_certificate /etc/letsencrypt/live/sub-nododb.domain.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/sub-nododb.domain.com/privkey.pem; | |
include /etc/letsencrypt/options-ssl-nginx.conf; | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | |
error_page 497 https://$host:443$request_uri; # SET TO DESIRED SSL PORT (3/3) | |
client_max_body_size 20M; | |
location / { | |
proxy_pass http://nocodb:8080; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Host $host:$server_port; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
chunked_transfer_encoding off; | |
proxy_buffering off; | |
proxy_cache off; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment