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!
You just need to define each virtual host in its own file.
<br>
<br>Try this.
<br>
<br>Running as root, or using sudo, type:
<br>
<br>cd /etc/apache2/sites-available
<br>nano yourdomainname.conf
<br>
<br>Then copy into the blank text file that opens:
<br>
<br><VirtualHost *:80>
<br> ServerName www.yourdomainname.com
<br> ServerAlias yourdomainname.com
<br>
<br>
<br> DirectoryIndex index.php
<br> DocumentRoot /var/www/yourdomainname
<br></VirtualHost>
<br>
<br>You should obviously change “yourdomainname” to whatever your details are.
<br>
<br>Also change the /var/www/yourdomainname to wherever you’ve stored the files for the site.
<br>
<br>And finally, swap index.php to whatever your index document is (or leave it as it is if you actually have an index.php).
<br>
<br>Then press ctrl+o to save the file.
<br>
<br>Press ctrl+x to exit nano.
<br>
<br>After this, at the command prompt, type:
<br>
<br>a2ensite yourdomainname.conf
<br>service apache2 restart
<br>
<br>If you want to disable the virtual host in the future, type:
<br>
<br>a2dissite yourdomainname.conf
<br>service apache2 restart
<br>
<br>Peter
Sorry, the text for the virtualhost file didn’t render properly in my answer. <br> <br>I’ve uploaded a text file for you to use here: <br> <br>https://s3-eu-west-1.amazonaws.com/tmsfiles001/ForumHelp/yourdomainname.conf
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.