- Create a LXC container with Debian
apt-get install nginx vim
systemctl enable nginx
systemctl start nginx
- The nginx website should be visible
- Lets create a reverse proxy now.
vim /etc/nginx/nginx.conf
Simple Config File
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log
events {
worker_connections 768;
# multi_accept on;
}
http {
server{
listen 80;
location / {
proxy_pass http://192.158.2.66:3000;
}
}
}
Note that right now, it points to my webserver running excalidraw on my local device.
HTTPS Config File
- Ensure that we have each certificate file in
/etc/nginx/ssl/
(cert and private key) We can write a config file like:
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log
events {
worker_connections 768;
# multi_accept on;
}
http {
server{
listen 80;
server_name yoshixi.net www.yoshixi.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name yoshixi.net www.yoshixi.net;
ssl_certificate /etc/nginx/ssl/pve-root-ca.pem;
ssl_certificate_key /etc/nginx/ssl/pve-root-ca.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 180m;
location / {
proxy_pass http://192.168.2.66:3000;
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;
}
}
}
systemctl restart nginx