Tag: HTTPS

how to reload ngnix without restart for a configuration change?

To reload Nginx after making configuration changes without restarting or dropping connections, you can use the following command:

sudo nginx -s reload

Explanation:

  • This command tells the running Nginx master process to gracefully reload its configuration.
  • It does not terminate existing connections.
  • New worker processes are spawned using the new configuration, and the old ones are shut down gracefully after serving ongoing requests.

Alternative (Systemd-managed systems)

If you’re on a system using systemd (most modern Linux distros like Ubuntu, CentOS 7+, Debian, etc.):

sudo systemctl reload nginx

Equivalent behavior — reloads configuration without restarting the entire service.

Before reloading — test your config:

Always validate the configuration file syntax before reloading:

sudo nginx -t

If it shows:

nginx: configuration file /etc/nginx/nginx.conf test is successful

Then you can safely reload.

Summary

CommandPurpose
sudo nginx -tTest configuration for syntax errors
sudo nginx -s reloadGracefully reload config (no restart)
sudo systemctl reload nginxSame as above, via systemd

Adding HTTP/HTTPS proxy for docker image downloads

As part of development your lab network or corporate network might be under a proxy network to download docker images.
This article explains on how to add HTTP/HTTPS proxy to download the docker images in a corporate environment.

Add the below lines

[Service]
Environment=”HTTP_PROXY=http://proxy.mycompany.com:80/”

in /etc/systemd/system/docker.service.d/http-proxy.conf

and

[Service]
Environment=”HTTPS_PROXY=https://proxy.mycompany.com:443/”

in /etc/systemd/system/docker.service.d/https-proxy.conf

Replace proxy.mycompany.com with your companies proxy server details.

Additionally add nameserver entry also to resolve hostnames.

#Use your DNS server details.
nameserver 172.10.22.1

in /etc/resolv.conf

Once added restart docker daemon and reload. Commands below.

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker