Any sample nginx config file available for n8n (docker)? So that I can host it as https

Describe the issue/error/question

Not able to host n8n as https. This is the nginx config file that I used . But when I try to open the url in the browser , It is showing 500 Internal Server Error

server {
listen 5678;

location / {
	proxy_pass http://$host:5678;


server {
listen 5678;
return 302 https://$server_name$request_uri;

server {
listen 5678;
listen 443 ssl;

ssl_certificate        /etc/nginx/certs/server.crt;
ssl_certificate_key    /etc/nginx/certs/server.key;

location / {

proxy_pass http://thehost:5678;
proxy_set_header Connection ‘’;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;

Information on your n8n setup

  • Running n8n via [Docker, npm ]: path(withPostgres-compose-docker-compose.yml)

Hey @AnjanaSAcroUser, welcome to the community!

I have used nginx in the past with this config file: GitHub - that-one-tom/n8n-on-oracle-vm: A step by step description of setting up n8n using Ubuntu, Docker, NGINX + UFW on an Oracle Cloud VM

This looks very similar to your config though, so there might be something else that’s wrong for you. Anything useful in your nginx logs?

Hey thanks for the reply. So I was not able to see any error logs in nginx. I went through the link. It was useful. It gave me an idea of what things are. But I am using nginx as a service in docker-compose yml file. So I was not able to make it work with the details provided in the link. I am using windows. I am completely new to n8n and nginx .
This is the yml file
version: ‘3.1’


image: nginx
- ./nginx/ssl:/etc/nginx/certs
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf

image: n8nio/n8n:latest
restart: unless-stopped
container_name: n8n
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=host.docker.internal

  - 5678:5678
  - ~/.n8n:/home/node/.n8n
command: /bin/sh -c "sleep 5; n8n start"

I am using some certificates that I used in my Django backend. Don’t know if I can use it in n8n. As far as I know we don’t have a domain name, some random IP address is there. Have any idea on How to connect to nginx.

Hey @AnjanaSAcroUser, I have never used nginx on Windows so don’t have much experience here. The 500 status suggests a problem with nginx itself so you might get better help with debugging this on an nginx forum.

What output exactly are you seeing when running docker logs for your nginx container?