Page History

Configuring NGINX

Joe edited this page 17 days ago

Clone this wiki locally
You can clone HTTP or SSH.

Configuring NGINX

Using NGINX as a reverse proxy in front of Klip is recommended.

  1. Create and open a new configuration file: sudo nano /etc/nginx/sites-available/klip.example
  2. Input configuration:
     server {
         server_name klip.example;
         listen 0.0.0.0:443 ssl;
    
         ssl_certificate /etc/letsencrypt/live/klip.example/fullchain.pem;
         ssl_certificate_key /etc/letsencrypt/live/klip.example/privkey.pem;
    
         add_header Referrer-Policy "strict-origin-when-cross-origin";
         add_header Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data:; object-src 'none';";
    
         location / {
           proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header    X-Forwarded-Proto $scheme;
           proxy_set_header    Host $http_host;
           proxy_http_version  1.1;
           proxy_pass http://127.0.0.1:3000;
        }
     }
  3. Link the configuration: sudo ln -s /etc/nginx/sites-available/klip.example /etc/nginx/sites-enabled/klip.example
  4. Test the configuration: sudo nginx -t
  5. Reload NGINX: sudo systemctl reload nginx