Connect with us

Wordpress Tips

How to Change Default Vhost Config Template for Nginx?

Here is a problem that we encountered when trying to update our Nginx software: the update was simply overwriting our custom Nginx rules, many of which were created to stop folks from messing with our sites. We use cPanel to manage our domains but were manually updating vhost config files for our domains. Updating them over and over again when you have a couple of sites is not tough. But if you have more than a dozen of sites, the process becomes time-consuming. You just have to find the “” files to address the issue.

📌 MemberPress: advanced WordPress plugin for subscriptions & membership sites


In our case, the file is located in our scripts directory (scripts/ Those of you who know your Nginx are going to find the file pretty easy to read. As you can see in the above example, there is no need to hard-code your IP (“%s” takes care of that). Things are a bit different for those of you who want tn ban certain IPs from accessing specific files and directories on your site.

nginx admin

Before making changes to your files, make sure you back them up. When you are done, you can rebuild your vhosts by going to: WHM -> Plugins -> Nginx Admin -> Rebuild Vhosts. Needless to say, you can build very sophisticated templates with this approach, but you have to know what you are doing.

Continue Reading
You may want to check out:
*some of our articles and lists include affiliate links to fund our operations (e.g. Amazon, Elegant Themes, Envato). Please read our disclaimer on how we fund Exxponent.
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in Wordpress Tips

To Top