Forum: 

Document Root not Working

Dickson Swanepoel's picture

Hi Everybody

I installed Turnkey LAMP and it works great. I can access all the menus in webmin. I then uploaded my web site to var/www/green90. But once I want to access my web site I keep on getting an error message from firefox.

Oops! This link appears to be broken.

I insert the following address http://192.168.2.2/var/www/green90/ - Then it does not work, and with my wamp server on my PC the site runs perfectly.

When I insert http://192.168.2.2 - I can access the server.

I have been searching for 3 hours now and testing to try and solve the problem. I also set the permissions on the directory and all sub directories to 777 for testing, but still not.

This is the contents of my /sites-available/default

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
</VirtualHost>

<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/cert.pem
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
</VirtualHost>

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        Order allow,deny
        allow from all
</Directory>
 

Please let me know how to fix this or what am I missing ?

Rudiger Wolf's picture

I've tried the wamp server.

You said > the following address http://192.168.2.2/var/www/green90/ - Then it does not work

Have you tried the following address http://192.168.2.2/green90/ ?

Jeremy Davis's picture

As /var/www is the document root then the contents of /var/www should display in your web browser using http://hostname-or-ip/ (in your example http://192.168.2.2 - note no www preceding the IP).

By default it will look for a file named index.htm (or variations of such eg index.html, index.php etc). If you don't have an index file you will need to explicitly state the filename (eg http://192.168.2.2/filename.htm). I'm not sure how the TKL LAMP appliance is setup but by default if there is no index file, apache will display the contents of the /var/www folder in the web browser.

If your page is in a sub directory (eg /var/www/green90) then is should display using http://hostname-or-ip/subfolder/ but again remember you probably want to explicitly define the page name if no index file exists.

Dickson Swanepoel's picture

I re-installed Turnkey LAMP on my server, just leaving all the default settings. After installing LAMP,  the default directory for your web site is (/var/www/). I created a new folder for my web site at  (/var/www/green90/) and installed my web site in that dierectory. To call the web site you have to use the following http://192.168.2.3/green90/index.php. (Where 192.168.2.3 is my server IP. So you leave out the (var/www/), and add your page at the end that you would like to connect to. This just shows you how such a simple thing can complicate your life as it took me more than 10 hours to figure out. Hope this helps someone else. Enjoy.

 

Thank You JedMeister


Post new comment