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?
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
@stobbsc
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:
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 setusername
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.Then
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
of0755
and files have a maximum of0644
, that’s the basics.Sidenote: Despite what some may say, a
chmod
of0777
(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.