skip to Main Content

I try to configure virtual hosts. All I do step by step like here

My config:

root@ubuntu:/etc/apache2/sites-available# cat mmv.com.conf
    # create new for [mmv.com]
    <VirtualHost *:80>
        ServerName www.mmv.com
        ServerAdmin [email protected]
        DocumentRoot /var/www/mmv.com
        ErrorLog /var/log/apache2/mmv.com.error.log
        CustomLog /var/log/apache2/mmv.com.access.log combined
        LogLevel warn
    </VirtualHost>

My index.html in root folder

cat /var/www/mmv.com/index.html
    <html>
    <body>
    <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
    Virtual Host Test Page
    </div>
    </body>
    </html>

My /etc/hosts

127.0.0.1       localhost
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


192.168.125.137 www.mmv.com

Looks like all I did right but if I try to open site www.mmv.com and I see default apache page.
Help me to find where I did mistake.
Thanks!

3

Answers


  1. Chosen as BEST ANSWER

    I found a solution! That right config:

    VirtualHost 192.168.125.138:80>
    
            ServerName  www.mmv.com
            ServerAlias mmv.com *.mmv.com
            ServerAdmin [email protected]
            DocumentRoot /var/www/www.mmv.com
    
            ErrorLog /var/log/apache2/mmv.com.error.log
            CustomLog /var/log/apache2/mmv.com.access.log combined
    
    </VirtualHost>
    

    And in file /etc/hosts have to be this:

    192.168.125.138 mmv.com www.mmv.com
    

  2. Try this:

    ln -s /etc/apache2/sites-available/mmv.com.conf /etc/apache2/sites-enabled
    

    Then restart your apache server.

    Login or Signup to reply.
  3. Stupid guess: the file is in sites-available, but was it enabled?
    If you have debian you can use a2ensite mmv.com, otherwise you have to use ln -s as Kiani advised in ^^^.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search