Linux: Nginx - eliminmax/cncs-journal GitHub Wiki

Linux: nginx

Meaning of different command prompts Unix/Linux: $: can be run as normal user
Unix/Linux: #: must be run as root (or with sudo)
Windows: >: Command Prompt or PowerShell
Windows: PS>: PowerShell only
Unix/Linux and Windows: $/>,#/>: Works in Windows and Unix/Linux.

Install nginx

Installing nginx is simple on most modern distros - install the nginx package with the default package manager.

Debian family

# apt install nginx

RHEL 8 family

# dnf install nginx

Configure nginx to use HTTPS

Once nginx is installed, and you have a signed certificate, navigate to /etc/nginx/sites-available, then edit the configuration files to use TLS/SSL - the following example redirects all HTTP requests to HTTPS:

server {
        listen 80 default_server;
        index index.html;
        server_name _;
        # redirect to HTTPS version of site
        return 301 https://for.example$request_uri;
}
server {
        root /var/www/html;
        listen 443 ssl;
        ssl_certificate /etc/ssl/for.example.crt;
        ssl_certificate_key /etc/ssl/for.example.key;
        server_name for.example;
        location / {
                try_files $uri $uri/ =404;
        }
}
⚠️ **GitHub.com Fallback** ⚠️