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 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
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!
It’s missing the html from the file, here is my new attempt, the { are greater than, less than signs <br> <br>{VirtualHost *:80} <br> # The ServerName directive sets the request scheme, hostname and port that <br> # the server uses to identify itself. This is used when creating <br> # redirection URLs. In the context of virtual hosts, the ServerName <br> # specifies what hostname must appear in the request’s Host: header to <br> # match this virtual host. For the default virtual host (this file) this <br> # value is not decisive as it is used as a last resort host regardless. <br> # However, you must set it for any further virtual host explicitly. <br> #ServerName www.example.com <br> <br> ServerAdmin andrewshay@shayconcepts.com <br> ServerName ftest.shayconcepts.com <br> DocumentRoot /home/scDev/ftest <br>{Directory /} <br> Options FollowSymLinks <br> AllowOverride None <br>{/Directory} <br>{Directory /home/scDev/ftest/} <br> AllowOverride None <br> Order allow,deny <br> Allow from all <br> Require all granted <br>{/Directory} <br> <br> # Available loglevels: trace8, …, trace1, debug, info, notice, warn, <br> # error, crit, alert, emerg. <br> # It is also possible to configure the loglevel for particular <br> # modules, e.g. <br> #LogLevel info ssl:warn <br> <br> ErrorLog ${APACHE_LOG_DIR}/error.log <br> CustomLog ${APACHE_LOG_DIR}/access.log combined <br> <br> # For most configuration files from conf-available/, which are <br> # enabled or disabled at a global level, it is possible to <br> # include a line for only one particular virtual host. For example the <br> # following line enables the CGI configuration for this host only <br> # after it has been globally disabled with “a2disconf”. <br> #Include conf-available/serve-cgi-bin.conf <br>{/VirtualHost}
I assume you changed the nameservers on your domain host for shayconcepts.com to point to DO, and then in the DNS in DO told it to use shayconcepts.com for your VM. If this is the case in the DNS section in DO you will add a record for ftest.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.