Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Reload Nginx Configuration #3

Closed
MiteshShah opened this issue Oct 19, 2012 · 3 comments
Closed

Auto Reload Nginx Configuration #3

MiteshShah opened this issue Oct 19, 2012 · 3 comments

Comments

@MiteshShah
Copy link
Member

When we create a symbolic link in /etc/nginx/sites-enabled

Then shell script auto detect any new file is created in /etc/nginx/sites-enabled
Then call nginx -t to check nginx configuration test
If nginx configuration test is passed
Then reload nginx using the following commands

service nginx reload

This following script is just a demo needed proper logging.

#!/bin/bash
dpkg --list | grep inotify-tools &> /dev/null
if [ $? -eq 0 ]
then
        echo "Inotify Tools Already Installed"
else
        echo "Installing Inotify Tools..."
        apt-get -y install inotify-tools
fi
while true
do
        inotifywait --exclude .swp -e create -e modify -e delete -e move  /etc/nginx/sites-enabled
        nginx -t
        if [ $? -eq 0 ]
        then
                echo "Reloading Nginx Configuration"
                service nginx reload
        fi
done
@rahul286
Copy link
Member

Nice. 👍

@rahul286
Copy link
Member

Also commit changes git (if nginx -t passes). DATETIME and may be WHOAMI and CLIENT-IP in commit message

@MiteshShah MiteshShah modified the milestones: Later, 1.3 - Debug "Doctor" Release Mar 4, 2014
ocomsoft pushed a commit to ocomsoft/nginx that referenced this issue Aug 6, 2014
Added supervisord and watcher script. Script inspired by EasyEngine/easyengine#3. Credit to https://github.com/MiteshShah
@MiteshShah MiteshShah removed their assignment Dec 24, 2014
@rahul286 rahul286 modified the milestone: Later Mar 30, 2017
@rahul286
Copy link
Member

rahul286 commented Jun 2, 2018

Update: This is no longer relevant in EE v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants