Question

var/www/index.html not showing up - just standard "It works!" page - how to solve?

Hi,

So I’ve got my server set up with LAMP, but I’ve go one problem. If I go to mydomain.com the standard “It works!” page shows up. I’ve placed my own index.html in var/www/ and if I go to mydomain.com/index.html it shows up. Naturally, I want mydomain.com to point to /var/www/index.html.

How do I fix this?

Thanks in advance,

  • W

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I followed these steps, taken from James Tansley, on this post https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04 <br> <br>1. Go to /etc/apache2/mods-enabled/ directory. To do this, type “cd /etc/apache2/mods-enabled/” without the quotes. <br>2. Open the dir.conf file so you can edit it. To do this, type “sudo nano dir.conf” without the quotes. <br>3. You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add index.php as the first item in the list. Doing so will tell Apache to first look for and load an index.php file before looking for the other index file extensions. <br>4. Press Ctrl+X to save your changes and then press Enter to exit the editor. <br>5. Restart Apache by typing “sudo /etc/init.d/apache2 restart” without the quotes.

Hi @andreas.john.wik

When you are configuring your Apache2 config file for mydomain.com, you need to set the root folder as /var/www/yourdomain.com. Here is an example config file which you can use:

<VirtualHost *:80>
    ServerAdmin admin@test.com
    ServerName test.com
    ServerAlias www.test.com
    DocumentRoot /var/www/yourdomain.com/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have done this, but it still isn’t working. Is there a setting in apache2 conf that i also need to do? php works from the command line, but in the browser, I can see the code. I have fixed this problem before but cannot figure out what’s wrong this time.