Reload Nginx configuration

ConfigurationNginxWebserver

Configuration Problem Overview


I am trying to modify the Nginx config file to remove a "rewrite".

Currently, I have this config file:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
	server {
		listen      80;
		server_name amc.local;
		return 301 https://$host:8443/index.html;
	}
}

Now I want to reload this config file, I tried

nginx -s reload
nginx -c <conf file>
nginx -s stop/start

In the log file, there is the line

2014/01/22 11:25:25 [notice] 1310#0: signal process started

but the modifications are not loaded.

Configuration Solutions


Solution 1 - Configuration

Maybe you're not doing it as root?

Try sudo nginx -s reload, if it still doesn't work, you might want to try sudo pkill -HUP nginx.

Solution 2 - Configuration

If your system has systemctl

sudo systemctl reload nginx

If your system supports service (using debian/ubuntu) try this

sudo service nginx reload

If not (using centos/fedora/etc) you can try the init script

sudo /etc/init.d/nginx reload

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questiondev691View Question on Stackoverflow
Solution 1 - ConfigurationcnstView Answer on Stackoverflow
Solution 2 - ConfigurationMohammad AbuShadyView Answer on Stackoverflow