1.0 KiB
1.0 KiB
tags, title, description, date, author
| tags | title | description | date | author | |
|---|---|---|---|---|---|
|
Nginx | Nginx | 2025-01-01 | Nikola Petrov |
Install
sudo apt update
sudo apt install nginx
Test config
sudo nginx -t
Config location
/etc/nginx
Restart
sudo service nginx restart
Template for reverse proxy
server{
listen 80;
listen [::]:80;
server_name _;
location / {
proxy_pass http://127.0.0.1:8000;
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;
}
}
For auto ssl/https
- Install snapstore
sudo apt update
sudo apt install snapd
- remove old certbot
sudo apt-get remove certbot
- Install certbot
sudo snap install --classic certbot
- Link command to /usr/bin
sudo ln -s /snap/bin/certbot /usr/bin/certbot
- Get and install cert
sudo certbot --nginx
- Test auto renewal
sudo certbot renew --dry-run