You are not logged in or registered. Please login or register to use the full functionality of this board...

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retain custom vhosts during a vhosts rebuild
#1
Lightbulb 
Due to the use of cPanel/WHM and munin monitoring, I find the following useful. I also use it for a single domain that requires a customised configuration. Could be helpful to some.

Create a /root/custom-nginx directory

Munin Part
Create /root/nginx-custom/localhost with the following (as seen in other threads):
Code:
server {
       listen 127.0.0.1;
       server_name localhost;
       location /nginx_status {
               stub_status on;
               access_log   off;
               allow 127.0.0.1;
               deny all;
       }
    location /whm-server-status {
     proxy_pass http://127.0.0.1:8081;
     allow 127.0.0.1;
     deny all;
    }
}
[Someone might like to check the syntax that I'm using Wink]


General Part
Create /root/nginx-custom/customvhosts.sh
Code:
cp /root/nginx-custom/localhost /etc/nginx/vhosts/localhost >/dev/null 2>&1
.. you could add any other custom domain to this file, for example:
Code:
cp /root/nginx-custom/mydomain.com /etc/nginx/vhosts/mydomain.com >/dev/null 2>&1
Give the above file 744 permissions
Remember to copy any customised vhosts from /etc/nginx/vhosts to /root/nginx-custom/

Edit /scripts/rebuildvhosts to look like this:
Code:
#!/bin/sh
# Nginx Admin Installer
# Website: www.nginxcp.com
#
# Copyright (C) NGINXCP.COM.
#
rm -rf /etc/nginx/vhosts
/scripts/createvhosts.py
#
echo "Copying custom vhosts"
/root/nginx-custom/customvhosts.sh
#
/etc/init.d/httpd restart
echo "Regenerate vhosts completed"


EJ
Reply
#2
Very informative post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)