Self-hosting nitter with docker-compose and nginx

In this short guide, I wanted to document the few steps needed to have nitter running with docker-compose behind nginx.

1. Clone the repo

git clone --depth 1

2. Configure nitter

Create a nitter.conf file in the root of the repo, by copying the example conf: cp nitter.example.conf nitter.conf

In nitter.conf file, change the redisHost to nitter-redis

Optionally, adapt the other settings, but for a bare setup, that’s the only change needed.

3. docker-compose setup

Since nitter is running behind nginx, thus a proxy, you can leave the exposed ports in docker-compose.yml as they are.

Alternatively, if you want to expose nitter under a different port than 8080, you can do so by changing the exposed ports like this:

Now run docker-compose up -d from the project directory to start nitter.

4. nginx setup

sudo vim /etc/nginx/sites-available/nitter

Add the following content to that file, just replacing the YOUR_DOMAIN placeholder.

upstream nitter {
    server max_fails=5 fail_timeout=60s;

server {
    server_name    YOUR_DOMAIN; # e.g.

    listen         80;
    listen         [::]:80;

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;

    client_max_body_size 16m;
    ignore_invalid_headers off;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    location / {
        proxy_pass http://nitter;

Now create a symbolic link to make the nginx configuration available:

sudo ln -s /etc/nginx/sites-available/nitter /etc/nginx/sites-enabled/nitter

Test the nginx setup with sudo nginx -t

And reload the nginx service with sudo service reload nginx

5. Configure your DNS

Update your DNS records to point with an A record to your server’s IP mapping it to the configured domain.

Here, have a slice of pizza 🍕