Question

Second Website on Subdomain

I am trying to set up another website on a subdomain.

I have followed the tutorial and forum post below but got no results: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04 https://www.digitalocean.com/community/questions/how-do-i-add-sub-domain-and-make-it-point-to-a-certain-directory

I’ve a wordpress website running on /var/www/html. I have created another website on /var/www/sanaltur and created a apache config file as follows:

cat /etc/apache2/sites-available/sanaltur.tarikznursal.com.tr.conf

UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin admin@mydomain.com

        ServerName sanaltur.tarikznursal.com.tr
        ServerAlias sanaltur.tarikznursal.com.tr

        DocumentRoot /var/www/sanaltur/

        <Directory /var/www/sanaltur/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined



</VirtualHost>

Then I used:

  1. a2ensite sanaltur.tarikznursal.com.tr.conf

command to enable the conf file.

Still, I can’t reach to subdomain.

Thank you for your help


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.

Bobby Iliev
Site Moderator
Site Moderator badge
June 9, 2020
Accepted Answer

Hi there @altugguzeloglu,

The configuration looks all correct. What you need to do is also add a DNS A record for your subdomain name to point to your Droplet’s IP address.

Once you add the A record for your domain, it might take up to 24-48 hours for the DNS cache to clear over the Globe before you could see the actual DNS changes.

Let me know how it goes! Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel