NGINX

Common commands

sudo systemctl restart nginx
sudo nginx -t # Validate config files
sudo ln -s /etc/nginx/sites-available/source /etc/nginx/sites-enabled/destination

PHP NGINX basic config file

server {
    root /var/www/project;
    index index.php index.html;
    server_name example.domain.com;

    location / {
        try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    }
}

Proxy pass config file

server {
    server_name example.domain.com;

    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        #proxy_set_header        Upgrade $http_upgrade; # WebSocket
        #proxy_set_header        Connection "upgrade"; # WebSocket
        proxy_pass              http://127.0.0.1:3000;
        proxy_read_timeout      90;
    }
}

Certbot

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.domain.com