What folders should I use for Laravel 5.*?

Hi All, I’m new to Digital Ocean, so hi :-)

I’ve just setup my first droplet with Ubuntu 14. and installed Lamp. Everything is working with regards to MySQL, FTP etc so pretty happy. I have a project that I have been developing using PHPstorm using Laravel 5.* and now I want to deploy it to my droplet.

Do I simply copy everything into var/www/[myproject] or do I need to separate folders to different locations on the server? Project structure is as follows on my local machine: [My Project] -app -bootstrap -config -database -public -resources -vendor

PHPstorm lets me map my local folders to server folders for easy deployment just need help with the structure from you guys?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


There’s really not a defined directory structure per se. As a general recommendation, the project will normally define the structure. Since you already have an existing project directory structure in place, you’re free to use the location of your choice – just make sure that the directory you select as “home” is configured to be used by your web server (which, from the tags, would be Apache).

If you’re simply looking for recommedations, I generally start with a command such as:

mkdir -p /home/username/htdocs/{public,private,logs/{access,error}}

This creates the following using a one-line command, which is the base structure. I’ll often store data below public and in private to simplify and organize.


Followed by the useradd command to set username to a home directory and remove the ability to login via SSH (using SSH’s internal SFTP allows SFTP to still be used and doesn’t require another FTP software to be installed). No password is set, thus even if the shell wasn’t modified, access would not be granted but I air on the side of assurance versus potential.

useradd -d /home/username -s /sbin/nologin username


chown root:root /home/username
chown -R username:username /home/username/htdocs

This ensures reading & writing starting from ./htdocs down to ./htdocs/{public,private,logs}, and no further (i.e. nothing is happening in /home/username).

Beyond the above, ensuring that directories have a maximum chmod of 0755 and files have a maximum of 0644, that’s the basics.

Sidenote: Despite what some may say, a chmod of 0777 (i.e. World Readable, World Writable and World Executable) is not required on a properly configured server, nor should it be an option. When using such permissive levels, you open yourself up to a growing list of potentials.

Anything outside of the above is done to simply tighten up security, such as using ACL’s to further restrict access and the ability to read, write and execute.