Linux: Nginx - eliminmax/cncs-journal GitHub Wiki
Meaning of different command prompts
Unix/Linux:$
: can be run as normal user
Unix/Linux:#
: must be run as root (or withsudo
)
Windows:>
: Command Prompt or PowerShell
Windows:PS>
: PowerShell only
Unix/Linux and Windows:$/>
,#/>
: Works in Windows and Unix/Linux.
Installing nginx is simple on most modern distros - install the nginx package with the default package manager.
# apt install nginx
# dnf install nginx
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;
}
}