User Tools

Site Tools


webapps:nitter

This is an old revision of the document!


Nitter

Ubuntu 20.04

This project, while good, required a decent amount of manual work just to get it up and running. There is next to zero documentation and uses some random language that has it's own issues getting installed properly.

Update and install nginx, redis (a caching server), and certbot

$ sudo apt update;sudo apt upgrade -y

Redis will automatically start itself and create a service, which is nice.

$ sudo apt install redis-server nginx
$ sudo apt install python3-certbot-nginx
$ sudo apt install libsass-dev # Required to run nimble scss
$ certbot --nginx certonly

Configure Nginx

server {
    listen 80;
    server_name nitter.placeholder.domain;
    # enforce https
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name nitter.placeholder.domain;

    ssl_certificate /etc/letsencrypt/live/nitter.placeholder.domain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/nitter.placeholder.domain/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ecdh_curve secp384r1;
    ssl_session_tickets off;
    ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:AES256+EECDH:AES256+EDH:!aNULL';
    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1.3 TLSv1.2;
    ssl_dhparam /etc/ssl/dhparam.pem;
    ssl_stapling on;
    ssl_stapling_verify on;

    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
    #
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    #add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;

    location / {
        proxy_pass http://localhost:8080;
    }
}

Install nim, just wget the latest package from their website. https://nim-lang.org/install_unix.html Their install script is improperly written/completely undocumented so you will need to manually copy nimble as that one is used to compile. Just stick it in /usr/bin. Below is an example using the current version of nim at the time of writing.

$ wget https://nim-lang.org/download/nim-1.4.4-linux_x64.tar.xz
$ tar xvf nim-1.4.4-linux_x64.tar.xz
$ cd nim-1.4.4/
$ ./install.sh /usr/bin
$ sudo cp bin/nimble /usr/bin/

Add a nitter user

$ sudo useradd -d /home/nitter -m nitter
$ sudo su nitter

Clone Nitter

$ git clone https://github.com/zedeus/nitter
$ cd nitter

Build Nitter

$ nimble build -d:release

Build CSS

$ nimble scss
$ mkdir ./tmp

Configure nitter /home/nitter/nitter.conf Just make sure to fill out the hostname and hmacKey, I gave my key and randomly generated 64 character string, seems to work.

Make it run on startup Systemd Service

[Unit]
Description=Nitter (An alternative Twitter front-end)
After=syslog.target
After=network.target

[Service]
Type=simple

# set user and group
User=nitter
Group=nitter

# configure location
WorkingDirectory=/home/nitter/nitter
ExecStart=/home/nitter/nitter/nitter

Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target
webapps/nitter.1614975465.txt.gz · Last modified: 2021/06/18 16:36 (external edit)