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


Recommended Posts

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.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts

 

Here is some initial info:

I have my website running just fine with the main domain http://shayConcepts.com and it's running from  /home/scDev/public_html

I'm trying to create a test sub domain, ftest.shayconcepts.com.   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 www.example.com

    ServerAdmin andrewshay@shayconcepts.com
    ServerName ftest.shayconcepts.com
    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
</VirtualHost>

sudo a2ensite xftest.conf

sudo service apache2 reload

sudo service apache2 restart

Link to comment
Share on other sites

This topic is now closed to further replies.