How to insert a code before before location / block?

Hi everyone, I am very new to nginx environment. I have installed WP CMS on my nginx server. Secondly, i am trying to hide the platform from cms detection so the wordpress hiding plugin wants me to manually rewrite the nginx.conf files and insert a rewrite code before the location / block of the configuration file.

Now usually the nginx.cinf files is location at /etc/nginx/sites-available/ however, in my case it under at /www/server/nginx/conf .

But the problem is there are two files of the configuration 1. nginx.conf and 2. nginx.conf.default

when I open the conf.default file it has a location / block where I can easily insert the code but since this is not the active configuration file I am forced to look into the existing nginx.conf file and insert code before any Location / block.

but this doesn’t help the plugin to verify the rewrite rules.

I am fairly a noob at this and require anyone with prior experience help solve this issue to verify the rewrite rules and further.

Here is the link to my nginx.conf file if it helps (

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 9, 2021
Accepted Answer

Hi there,

I think that the Nginx config file that you’ve shared is for your PHPmyAdmin installation, this is why the rewrite rule might not be working. Otherwise, I believe that it is placed at the correct location in the config file.

As this does not look like a standard Nginx setup, are you using a specific control panel?

I believe that you need to find the correct Nginx server block file which is responsible for your WordPress website and add the rewrite rule there.

Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel