How to install DevKinsta site in a subdirectory

I’m using DevKinsta to develop and sync locally, but I would like to put my local site in a subdirectory, so that I can store site documentation, etc, in my git repo. Is this possible?

Hi @juliaset ! :wave: Welcome to the Kinsta community.

You can place additional files in a subdirectory inside your site installation in DevKinsta; however you would then either need to access that information via the subdirectory, or edit the Nginx configuration within your DevKinsta site so that you can access the subdirectory locally.

You can edit the Nginx configuration within your site with this command:

docker exec -it devkinsta_nginx bash

You’ll find .conf files contained within /etc/nginx/sites where you can change the root directory or make other configuration tweaks, but those changes won’t be preserved if the site is pushed up to a Staging container on MyKinsta.

To edit those files, you may want to install your preferred command-line text editor, such as apt install nano to install the nano editor.

Hi Jack. Thanks for the tips. I didn’t explain myself very well…what I’m trying to do is something like this:

DevKinsta
└── public
    └── [github repo folder]
        └── README.md
        └── [mysite]
            └── [wp-admin]

Is this possible?

Hi @juliaset! Thank you for your reply!

Thank you for providing that example! Technically, for local development of your site it is possible to modify the directory structure and update the NGINX configuration to match this new path. You could create the GitHub repo folder, and the additional folder for your site and move the site files/directories into that new folder. Then, you can update the NGINX configuration in DevKinsta through the site configurations page. You may find this editor by selecting your site from the list in DevKinsta, and then select the wrench icon on the left side of the DevKinsta window.

In the NGINX configuration you will look for the line that starts with “root”. You would then update the path there to match the new directory path you placed the site files/folders in.

This will allow you to use that new directory structure for local development.

The push to Kinsta process however will be a bit more of a manual process. When pushing from DevKinsta to MyKinsta the files/folders from the original site path are what is pushed. This means on Kinsta the site’s directory structure would appear as /www/sitename/public/githubrepo/sitefolder. The problem with this is by default the NGINX configuration on the site will be configured as /www/sitename/public as the root path. This means by default the site files will be unable to be served correctly. To correct this, you can reach out to our Support team who would be happy to update the root path to match the new directory structure for you.

You would also need to manually update the wp-config.php file’s database configuration to match that of the Kinsta site container. As the wp-config.php file is no longer located in the default DevKinsta site path this change would not occur automatically.

Please don’t hesitate to reply if you have any questions! We’re always happy to help!

Best regards

1 Like

Ahh, thank you! That’s exactly what I was looking for.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.