Ace Caserya
Ace Caserya

Reputation: 2923

Where is the proper place to install Laravel projects?

New to Laravel, I use composer for easy install of Laravel project on my Mint 16.

Currently I use /usr/local/bin, one directory per project. This means every time I launch the composer I had to "sudo" my way to create a directory and install. Same if I want to edit contents.

I was wondering if there are standards into where is the proper location of Laravel projects and if I do will there be problems?

Upvotes: 0

Views: 1896

Answers (1)

Moshe Katz
Moshe Katz

Reputation: 16873

There are no real standards for where to put projects. That said, you will most often find the following recommendations:

  • /var/www/ (or, more recently, /var/www/html/)
    This is the default location where Apache on Debian derivatives (like Mint) look for the "default" website. Many people, once they have disabled the "default" website, just put all of their websites in this location. This also means that if you keep the default website, then you can access your projects as subfolders of it. (Note, however, that your applications must be built with access from multiple paths in mind in order to take advantage of that.)

  • /srv/www/
    /srv is defined in the FHS as being for "Site-specific data which are served by the system." This could arguably include websites served, so some people put them here.

  • /home/USER/www/ (or similar things like /home/USER/websites/, .../public_html/, etc.)
    This layout was popularized by control panel software like cPanel and Plesk because it allows you to actually have each website "owned" by a particular user. If you do development work for multiple organizations using the same computer, or if you just want to have projects in some hierarchy, this is the best one to use. If you are using Apache as your webserver and yyou have mod_userdir enabled, this will allow you to access all of your sites at http://example.com/~USER/foldername (with the caveat about paths mentioned in the note above).
    One good example of the use of this location is Laravel's Homestead development environment, which defaults to putting sites in /home/USER/Code/. (However, I do not consider this an official "recommendation" from Laravel that this is how it should be done; rather it's just a "we do it this way for convenience".)

Upvotes: 3

Related Questions