Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i looking at trying to make my web server easier to manage, backup and replicate. I have websites, config files, ssl certs, vhosts scattered all over the place. It seems logical that they should all be in one place. i was thinking of creating a directory in root like so

/data

and inside this have all the directories for my data on this webserver like so:

/data 
    /websites                    [websites directories]
    /ssl_certs                   [secure certificates for sites]
    /vhosts                      [virtual host files for sites]
    /config                      [Software config files (apache, mod_security etc.)
        /apache2                 [Apache Server Config files]
        /proftpd                 [FTP Server Config files]
    /utilities                   [Misc Bash Scripts]

this would mean if i had to replicate this server, i could install and config the required packages and then copy this folder across which will contain all of my data. Also i could backup everything on my server easily and quickly so in the event of needing to restore i would have all my data in one place.

so i have 3 questions:

is this a good idea or would it be more hassle than its worth?

would there be any security implications of doing things this way?

what is the standard way of doing this if the above is not feasible?

share|improve this question

closed as not constructive by Iain, Michael Hampton, HopelessN00b, John Gardeniers, Magellan Oct 15 '12 at 1:22

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
If you're creating your own hierarchy, it's probably not a standard configuration... –  Bart Silverstrim Jan 9 '12 at 12:07
add comment

4 Answers

up vote 2 down vote accepted

Different sites do different things; if you have a backup system in place and disaster recovery plan that is thoroughly documented, and your config files are properly set up, where you put the files won't matter.

"Standards"...there's so many of them that it's a stupid name. There are typical sites but even that varies by distro and web server.

In the end, if you have it properly documented and backed up, this shouldn't be a problem. Do what fits best with your business/workflow and don't worry about it.

share|improve this answer
add comment

I have something like this:

  • /etc/
    • apache2/
      • sites-available/
      • sites-enabled/
    • ssl/
      • *.crt
      • private/
        • *.key
  • /srv/
    • www/
      • $site/
        • htdocs/
        • logs/
        • cgi-bin/
share|improve this answer
2  
kudos for using /srv/ it is the location that the FSH standard and the gods want server specific data to reside. –  pfo Jan 9 '12 at 12:41
add comment

Typically configs go in /etc/appname (so certs are in /etc/nginx/certs/, passwords are /etc/nginx/passwords, individual vhost configs are in /etc/nginx/sites/, etc). This is not considered to be messy or 'all over the place'; everything is within the /etc/nginx/ dir.

The contents of the sites typically go in go in /var/www/site1, /var/www/site2, but this is configured on a per-site basis, and does not need to conform to this convention. (Each site could be in a radically different place if you choose, so long as the httpd has access.)

Note: I typically use nginx, but the config directory for apache should be /etc/apache2/. The same sentiment applies.

Note: it is another common convention to use /etc/apache2/sites-enabled/ and sites-available/, but I personally dislike that approach.

share|improve this answer
add comment

Unlike the other respondents I think there's a strong case for not using the default file layout - just as there are very good reasons for not using the default permissions model.

The issue I have with what you propose is that you've called the directory 'data' - I'd want to keep all the config and the SSL certs well separated from the content. And since the default config will mostly be /etc anyway, that seems like the logical place to leave it.

Where you may run into problems is where you add packages which will make changes to the config (e.g. adding apache modules). Intelligent use of directory softlinks can help with this.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.