Mobile app version of vmapp.org
Login or Join
Correia994

: Permissions & File Structure w/ nginx & multiple sites I am using nginx for the first time as a long time Apache user. I setup a Linode to test everything and to eventually port over my

@Correia994

Posted in: #Nginx #Security

I am using nginx for the first time as a long time Apache user. I setup a Linode to test everything and to eventually port over my websites.

Previously I had /home/user/www (wwwroot)

I am looking at doing something similar with /srv/www/domain/www (wwwroot)

Rather than using /srv/domain (wwwroot), the reason is many of the sites are WordPress and one of the things I do for security is to move the config file one level above wwwroot and can't have multiple configuration files from multiple domains in the same top level folder.

Since I own all the sites, I wasn't going to create a user for each domain. My user is a member of www-data and was going to use 2770 for www and have domain/www for each new domain. www would be owned by group www-data.

Is this the best way to handle this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Correia994

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gloria169

Perhaps the best way to do this is to copy the wp-config.php file into the parent directory but name it after the site it is related to. Then place a require_once() call to it inside the regular wp-config.php file.

/var/www/site1.com/wp-config.php
/var/www/site1-config.php

/var/www/site2.com/wp-config.php
/var/www/site2-config.php

Inside /var/www/site1.com/wp-config.php you would have the following code:

<?php
require_once('/var/www/site1-config.php');


Inside /var/www/site2.com/wp-config.php you would have the following code:

<?php
require_once('/var/www/site2-config.php');


You could even have a specific directory for them such as /var/www/wp-configs and place them all in there then require_once('/var/www/wp-configs/siteX-config.php') just so they don't clutter up the /var/www directory.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme