Organizational Research By

Surprising Reserch Topic

Does the Document Root Point to the Location of your Files?


Another consideration is whether your web server is pointed at the correct file location.

Each virtual server in Apache or server block in Nginx is configured to point to a specific directory. If this is configured incorrectly, the server will throw an error message when you try to access the page.

In Apache, the document root is configured through the DocumentRoot directive:


    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html
. . .
This line tells Apache that it should look for the files for this domain in the /var/www/html directory. If your files are kept elsewhere, you'll have to modify this line to point to the correct location.

In Nginx, the root directive configures the same thing:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name example.com www.example.com;
. . .
In this configuration, Nginx looks for files for this domain in the /usr/share/nginx/html directory.
asked Jun 9, 2015 in LINUX by rajesh
0 votes
14 views



Related Hot Questions



Government Jobs Opening


...