nginx basic commands
Check Configuration syntax before reloading
$ nginx -t
Display current configurations:
$ nginx -T
Reload nginx
$ nginx -s reload
Check Configuration syntax before reloading
$ nginx -t
Display current configurations:
$ nginx -T
Reload nginx
$ nginx -s reload
This will show you how to setup ngin-proxy-manager so that it's not publicly available
Change docker compose:
- '127.0.0.1:81:81' # Admin Web Port
sudo docker-compose up -d
Connect with Visual Studio Code, 81 port will be automatically forwarder and be accessible.
First download Nginx Proxy Manager
This tutorial assumes you are using nginx proxy manager docker image.
After setup add default configuration:
Create 2 files with content:
Included at the top of the main http block
/opt/docker/nginx-proxy-manager/data/nginx/custom/http_top.conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
Included at the end of every proxy server block:/opt/docker/nginx-proxy-manager/data/nginx/custom/server_proxy.conf
location /websocket {
proxy_pass http://127.0.0.1:8072;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
proxy_cookie_flags session_id samesite=lax secure; # requires nginx 1.19.8
}
Check if port 8072 is opened:
sudo netstat -atlp | grep 8072