3

Here is an example of the file structure of a Linux distro: https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-filesystem-fhs.html

Each directory has a specific purpose, and seems like a web application should be distributed in different directories rather than being encapsulated in a folder.

The initial structure of my web app is as follows:

/home/username/appname/appsource...
/home/username/appname/appconfiguration...
/home/username/appname/apptempdata...
/home/username/appname/applogdata...
/home/username/appname/appdata...
/home/username/public_html/appname/appsite/...

The app is encapsulated in a minimum of directories within the Linux system, one for the web-source/web-site (the pages, javascript, css, website images), in the other directory (/home/username/appname/...) is the rest of the application files.

The application was initially placed in an user folder just because that's where the web app started developing through certain web tool, but now is needed to break away the app from the web tool and from the server user, and is needed to create an installation method (in the end different admin users of a given Linux server will rotate to manage the application files if given permission in the Linux system).

From what I researched (see the FHS specifications), I understand that the app files have to be redistributed as follows:

/usr/lib/appname/appsource...
/etc/appname/appconfiguration...
/var/www/html/appname/appsite...
/var/tmp/appname/apptempdata...
/var/log/appname/applogdata...
/var/lib/appname/appdata...

If I was to just make things work now, I would just place everything in the /var/lib and /var/www/html directories:

/var/lib/appname/appsource...
/var/lib/appname/appconfiguration...
/var/www/html/appname/appsite...
/var/lib/appname/apptempdata...
/var/lib/appname/applogdata...
/var/lib/appname/appdata...

Should I do that? If not then please explain what are the main reasons, and how should the example files be located?

migrated from softwareengineering.stackexchange.com Jun 10 '17 at 19:35

This question came from our site for professionals, academics, and students working within the systems development life cycle.

0

I am not an expert on this topic, but the original solution I came to by reading the FHS specifications, seems to be actually right (or pretty close), I even found this article, which says that the /opt and /usr/local directories are not necessary anymore with the apparition of RPM's, that article says that those directories are now obsolete and make sysadmins' and users' life less easy.

All my web application is written in PHP, which means that my app does not include any binaries, so I just put all the application programs in /usr/lib. If your application has binaries, you will need /usr/bin or /usr/sbin. I don't either use /usr/share/doc nor /usr/share/man, because my app doesn't include documentation nor manuals (for the moment).

/var/www is not part of the FHS, so the files located in /var/www/html/appsite can be placed somewhere else, it will depend on how you configure the web server application (Apache, Nginx or other).

On the other hand, the second approach in the OP is discarded, because it's just lazy and doesn't really try to comply with the FHS.

So my conclution remains:

/usr/lib/appname/appsource...
/etc/appname/appconfiguration...
/var/www/html/appname/appsite...
/var/tmp/appname/apptempdata...
/var/log/appname/applogdata...
/var/lib/appname/appdata...

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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