Hey everyone, so I’ve been learning web dev for a while now.
I learned django + react etc. Now I’m learning WordPress.
When you have a LAMP project, for example in my raspberry pi locally or in a VPS at Linode…
**QUESTION #1:** Where is the CORRECT directory to put a wordpress or HTML+CSS+JS website if you are working with Apache?
I’ve seen tutorials where they use 2 different places not sure why:
/var/www/html/mywordpress-site-folder
/var/www/mywordpress-site-folder
OR they even move all the wordpress files from “mywordpress-site-folder” and place them either in www/ OR in /html folders…
Why and when do you use one directory over the other?
**QUESTION #2:** I’ve also seen they even create a new file or folder (don’t remember if it was a file or folder) called “public\_html” within /var/www/
I’m kinda confused…any guidance will do! Thanks
It doesn’t matter as long as your apache virtual hosts points to the correct folder, and the folder permissions are set up securely.
I prefer to create a directory in the www folder for each website I host on that machine but in the end of the day it’s up to your preference mostly, as long as you keep security in mind.
/var/www/html is the default site
every other site would be
/var/www/site1
/var/www/site2
etc.
in your site folders you might choose to have a logs/ and siteroot/ etc too.
Working at a webhost, we put websites in /home/USER/public_html. But, basically anywhere works as long as you set the permissions and configuration of your webserver correctly