contentintech
DevOps

Nginx

Check configuration, proxy requests and operate a web server.

Updated Official documentation ↗

Operate

nginx -tValidate configuration before reloading
nginx -s reloadReload after a successful configuration check
systemctl status nginxInspect the service on systemd hosts
journalctl -u nginx --since todayRead service logs on systemd hosts

Server configuration

listen 80;Listen for HTTP traffic
server_name example.com;Match a hostname
root /srv/www;Set the filesystem root
index index.html;Choose the directory index file

Reverse proxy directives

proxy_pass http://127.0.0.1:3000;Forward requests inside a location block
proxy_set_header Host $host;Preserve the request hostname
proxy_set_header X-Real-IP $remote_addr;Forward the direct client address
client_max_body_size 10m;Bound accepted request-body size

Section navigation