Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default page Apache2 Ubuntu

Tags:

ubuntu

apache2

When I go to my website an index of all the files shows up, when I choose a specific page the html isn't able to access the images in a file. How can I make Apache2 automatically launch /var/www/home.html instead of /var/www?

like image 528
Wesxdz Avatar asked Oct 19 '13 15:10

Wesxdz


2 Answers

You can use DirectoryIndex directive in vitual host context.

From apache website

The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name.

Here's the example:

<virtualhost *:80>

  ServerName  domain.com
  ServerAlias www.domain.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex home.html index.html
  DocumentRoot /var/www

</virtualhost>
like image 119
Chawarong Songserm PMP Avatar answered Sep 21 '22 22:09

Chawarong Songserm PMP


In Apache2, specifying DirectoryIndex directive inside virtualhost tag of sites-available/default configuration file didn't work for me. Instead, placing DirectoryIndex directive inside Directory tag of apache2.conf file as mentioned in http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex did exactly what we want.

like image 34
gulam Avatar answered Sep 17 '22 22:09

gulam