Yagiz
Yagiz

Reputation: 1033

Apache2 Multiple Domains addition to Ubuntu 12.04

Sorry to start a discussion on something that was discussed before. But I couldn't find a proper solution to my problem. Thank you for reading.

I have a VPS server and I've added default root to it using /etc/apache2/sites-available/default file.

My default file is

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/root/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/root/>
            Options None
            AllowOverride None
            Order deny,allow
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Later on I added a new domain called alfonsoapp.com, but now it works on the default root which is /home/root/files/ but it should work on /home/alfonsoapp/files, where did I do wrong?

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/alfonsoapp/files/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/alfonsoapp/files>
            Options None
            AllowOverride None
            Order deny,allow
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Upvotes: 0

Views: 300

Answers (1)

Yagiz
Yagiz

Reputation: 1033

I found out the problem. I should have added these codes in sites-available/alfonsoapp.com file

  ServerName  domain.com
  ServerAlias www.domain.com

Upvotes: 1

Related Questions