Can't get subdomain to work via virtual hosts - Ubuntu

Hey all,

I’m new to working with webservers manually and I am trying to setup a subdomain via apache’s virtual hosts but I can’t get it to work. This is the tutorial I followed https://www.digitalo…buntu-12-04-lts

Here is some initial info:

I have my website running just fine with the main domain and it’s running from /home/scDev/public_html

I’m trying to create a test sub domain, Located at /home/scDev/ftest

My domain is not through digital ocean

And here’s exactly what I did

sudo chown -R $USER:$USER /home/scDev/ftest

(I also tried sudo chown -R www-data:www-data /home/scDev/ftest

sudo chmod -R 755 /home/scDev/ftest

created an index.html in ftest

cd /etc/apache2/sites-available

sudo cp ./default.conf ./xftest.conf

Here’s the contents of xftest.conf

<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request’s Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName

DocumentRoot /home/scDev/ftest

<Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/scDev/ftest/> AllowOverride None Order allow,deny Allow from all Require all granted </Directory>

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

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

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf


sudo a2ensite xftest.conf

sudo service apache2 reload

sudo service apache2 restart

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.

I assume you changed the nameservers on your domain host for to point to DO, and then in the DNS in DO told it to use for your VM. If this is the case in the DNS section in DO you will add a record for ftest.

I did not. Do I do this under DO or my domain host?

Did you add an ftest record pointing to your server under the DNS settings of