Question

Adding a subdomain on Apache2 (Ubuntu 12.04)

Hello. I’m trying to add a subdomain “dev” to my site which is running on Ubuntu 12.04x64 I had spent a few days to do this, but without any result. Only “This webpage is not available.” error.

Here is a zone file showed in https://cloud.digitalocean.com/domains/ubium.ru

$ORIGIN ubium.ru.
$TTL 1800
ubium.ru. IN SOA ns1.digitalocean.com. hostmaster.ubium.ru. 1424702134 10800 3600 604800 1800
ubium.ru. 1800 IN NS ns1.digitalocean.com.
ubium.ru. 1800 IN NS ns2.digitalocean.com.
ubium.ru. 1800 IN NS ns3.digitalocean.com.
ubium.ru. 1800 IN A 188.166.63.44
dev.ubium.ru. 1800 IN A 188.166.63.44
*.dev.ubium.ru. 1800 IN CNAME dev.ubium.ru.
*.ubium.ru. 1800 IN CNAME ubium.ru.

Here is apache2.conf

<VirtualHost 188.226.173.208:8080>

    ServerName ubium.ru
    ServerAlias www.ubium.ru
    ServerAdmin info@ubium.ru
    DocumentRoot /home/ubium/web/ubium.ru/public_html
    ScriptAlias /cgi-bin/ /home/ubium/web/ubium.ru/cgi-bin/
    Alias /vstats/ /home/ubium/web/ubium.ru/stats/
    Alias /error/ /home/ubium/web/ubium.ru/document_errors/
    #SuexecUserGroup ubium ubium
    CustomLog /var/log/apache2/domains/ubium.ru.bytes bytes
    CustomLog /var/log/apache2/domains/ubium.ru.log combined
    ErrorLog /var/log/apache2/domains/ubium.ru.error.log
    <Directory /home/ubium/web/ubium.ru/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory /home/ubium/web/ubium.ru/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid ubium ubium
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID ubium ubium
    </IfModule>

    Include /home/ubium/conf/web/apache2.ubium.ru.conf*

</VirtualHost>


<VirtualHost 188.226.173.208:8080>

    ServerName dev.ubium.ru
    ServerAlias www.dev.ubium.ru
    ServerAdmin info@ubium.ru
    DocumentRoot /home/ubium/web/ubium.ru/public_html
    ScriptAlias /cgi-bin/ /home/ubium/web/ubium.ru/cgi-bin/
    Alias /vstats/ /home/ubium/web/ubium.ru/stats/
    Alias /error/ /home/ubium/web/ubium.ru/document_errors/
    #SuexecUserGroup ubium ubium
    CustomLog /var/log/apache2/domains/ubium.ru.bytes bytes
    CustomLog /var/log/apache2/domains/ubium.ru.log combined
    ErrorLog /var/log/apache2/domains/ubium.ru.error.log
    <Directory /home/ubium/web/ubium.ru/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory /home/ubium/web/ubium.ru/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid ubium ubium
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID ubium ubium
    </IfModule>

    Include /home/ubium/conf/web/apache2.ubium.ru.conf*

</VirtualHost>

<VirtualHost 188.166.63.44:8080>

    ServerName dev.ubium.ru
    ServerAlias www.dev.ubium.ru
    ServerAdmin info@ubium.ru
    DocumentRoot /home/ubium/web/ubium.ru/public_html
    ScriptAlias /cgi-bin/ /home/ubium/web/ubium.ru/cgi-bin/
    Alias /vstats/ /home/ubium/web/ubium.ru/stats/
    Alias /error/ /home/ubium/web/ubium.ru/document_errors/
    #SuexecUserGroup ubium ubium
    CustomLog /var/log/apache2/domains/ubium.ru.bytes bytes
    CustomLog /var/log/apache2/domains/ubium.ru.log combined
    ErrorLog /var/log/apache2/domains/ubium.ru.error.log
    <Directory /home/ubium/web/ubium.ru/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory /home/ubium/web/ubium.ru/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid ubium ubium
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID ubium ubium
    </IfModule>

    Include /home/ubium/conf/web/apache2.ubium.ru.conf*

</VirtualHost>

And here is hginx.conf

server {
    listen      188.226.173.208:80;
    server_name ubium.ru www.ubium.ru;
    error_log  /var/log/apache2/domains/ubium.ru.error.log error;

    location / {
        proxy_pass      http://188.226.173.208:8080;
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|exe|pdf|doc|xls|ppt|txt|odt|ods|odp|odf|tar|bmp|rtf|js|mp3|avi|mpeg|flv|html|htm)$ {
            root           /home/ubium/web/ubium.ru/public_html;
            access_log     /var/log/apache2/domains/ubium.ru.log combined;
            access_log     /var/log/apache2/domains/ubium.ru.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/ubium/web/ubium.ru/document_errors/;
    }

    location @fallback {
        proxy_pass      http://188.226.173.208:8080;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/ubium/conf/web/nginx.ubium.ru.conf*;
}

Please, help me, if it is possible.


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.

Hello. Thank you for your advise:) But now i have another problem. My domain http://ubium.ru/ is always shows apache default page and any VirtualHost changes had no result. I tried to configure it like in this tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts May be this domain did not connected to my droplet ?

A quick lookup of your domain name is showing that you have not pointed it to our DNS servers so the records you have created for it are not yet being used:

domain:        UBIUM.RU
nserver:       dns1.yandex.net.
nserver:       dns2.yandex.net.

You’ll need to point your domain to our nameservers (listed below) with your registrar:

ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.com