Where is the root directory of my web site?
Can you let me know where the website data/public html folder for my website is located?
As @AlfredoRamos mentioned, this is difficult to determine without having access/knowing your directory structure. It also depends on how/when you configured your web server and the kind of web server you are using to deploy your site.
That being said, most web servers have a standard of configuration for their directory structure when first initializing the website.
Also keep in mind, depending on your distro/server version these may differ. But in general the document root for Apache and Nginx (most common opensource web servers) might be in one of these directories:
So say you are running an Nginx webserver and are looking for content being served when you visit your site www.example.com you might find it here:
To find out exactly where your document root lives, you can look in your servers configuration file. Here you can also modify your web servers configurations, like what port you'll be serving your site, or change where your document root lives, etc., you might find that config in one of these directories:
So lets say you are looking to change the index (first page being served) when a user visits your site www.example.com, you'd want to modify your configuration file:
To add onto Austin's post, I'd like to provide some instructions on how to find the configuration file.
The common Apache configuration file path is in
/etc/apache2/sites-available/examplesite. Depending on what your developer named the directory,
examplesite will vary. To verify the directory name, you would run the command
ls -la /etc/apache2/sites-available. The output of that command would look something like this:
total 24 drwxr-xr-x 3 root root 4096 Sep 4 19:54 . drwxr-xr-x 8 root root 4096 Aug 26 15:25 .. -rw-r--r-- 1 root root 1332 Feb 3 2019 000-default.conf -rw-r--r-- 1 root root 6338 Feb 3 2019 default-ssl.conf drwxr-xr-x 2 root root 4096 Sep 4 19:54 examplesite
In the example output I shared with you,
examplesite is a directory within that file path. This is indicated by the
d in file permissions (
drwxr-xr-x). You should be able to find a file with the extension
.conf within that folder. The
.conf file will indicate the file path of where the index files are. To look at a .conf file, you want to run the command
cat /etc/apache2/sites-available/examplesite/example.conf. A
.conf file will look something like this:
# domain: example.com # public: /var/www/html/example.com/public_html/ <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com/public_html # Log file locations LogLevel warn ErrorLog /var/www/html/example.com/log/error.log CustomLog /var/www/html/example.com/log/access.log combined </VirtualHost>
In this output, you'll want to focus on
# Index file and Document Root (where the public files are located). Index files are where you will make modifications to change the look of the front web page. To edit an index file, you'll have to run the command
If you get
permission denied errors in any part of this process, you'll need to run the command using
sudo before it, and enter the root password of your Linode (not your Manager password). Running a
sudo command for editing the example configuration file would look something like this:
sudo nano /etc/apache2/sites-available/examplesite/example.conf