Are NGINX rules transferred to and from DevKinsta?

I’am a Kinsta user.
I needed some specific Nginx rules to make a WP plugin work properly (the plugin redirect some images’s url).
The Support team from Kinsta just installed them on my Kinsta environment.

My question is : would those rules be downloaded (imported) from Kinsta environment to DevKinsta when I will import my website into DevKinsta ?

And, after that, would those rules be upload when I will push the site from DevKisnta to Staging environment ? (and after that into live)?

If yes, perfect!

If not, how can I add those rules to Devkinsta ?

Bellow are the rules :
rewrite ^/([_0-9a-zA-Z-]+/)?wp-admin$ /$1wp-admin/ redirect;
if (-e $request_filename){
rewrite ^/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) /2 break; } rewrite ^/([_0-9a-zA-Z-]+/)?(.*\.php) /2 break; rewrite ^(.*) /index.php break;

Thanks ,

Hi Alex,

DevKinsta does not automatically push or pull the Nginx configurations from your Kinsta site and so those would need to be added manually to work on DevKinsta.

To do this, you will need to open your command prompt and run the following command:

docker exec -it devkinsta_nginx bash

You’ll then need to install a text editor of your choice

apt update && apt install nano -y


apt update && apt install vim -y

Once you’ve installed an editor, you’ll want to navigate to the following directory

cd /etc/nginx/sites

There you’ll see a few different files. Look for the one that resembles your site name. It should also be the only one with .conf on the end of the file.

Then you would edit the file using nano/vim.

nano /etc/nginx/sites/sitename.conf

Add your changes below the last location block as shown here:

Once this is done, exit your text editor and the container. You can use control+d to exit or cmd + d on MacOS.

Now restart the Nginx container with the following command:

docker restart devkinsta_nginx

Hi Jeff,
Thanks for your detail answer. I will try that.

1 Like

Works Great !
Thank you Jeff!

Awesome! Glad to hear it.

Hi Jeff,
I might have celebrate victory too quickly.
I just noticed that after I restart the Ngnix contener (docker restart devkinsta_nginx), the edits I have done and saved to the file (nano /etc/nginx/sites/sitename.conf) are not present anymore…
(and of course, I change sitename.conf with my own website-name.conf)

I just tested locally and it does seem that restarting the Nginx container wipes the configuration. I wasn’t sure if this would happen and assumed it would not.

Since this is the default behavior, I would recommend putting in a feature request here for the ability to upload custom nginx rules from DevKinsta that will stick on restarts so our developers can review that for future releases.

In the meantime, I did find a workaround but it means you have to insert the data any time you restart DevKinsta or the Nginx docker container.

My fix was to edit the file, then, instead of restarting the container, run this command and exit the terminal window.

nginx -s reload

Thank you Jeff I will try that