my conf:
<VirtualHost *:80> ServerName test.com DocumentRoot “/var/www/somedir1/” UseCanonicalName Off ErrorLog logs/test.com-error.log CustomLog logs/test.com-access.log combined env=!dontlog </VirtualHost> ############################################################################ <VirtualHost *:80> ServerName test2.com DocumentRoot “/var/www/test2.com/” UseCanonicalName Off ErrorLog logs/test2.com-error.log CustomLog logs/test2.com-access.log combined env=!dontlog </VirtualHost> #############################################################################
and i still get a welcome page, apache 2.4.6
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!
Hi @mfadeyev,
Please set the virtualhost for your website test.com like so:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName your_domain
ServerAlias www.your_domain
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
You’ll need to change the relevant paths. Additionally, please remove UseCanonicalName Off It should work without it properly.
One other thing, have you created separate configuration files for both domains like so sudo nano /etc/apache2/sites-available/your_domain.conf
Where your_domain.conf is your actual domain?
You’ll need to enable the website afterwards as well like so :
sudo a2ensite your_domain.conf
Regards, KDSys
If you’re running a PHP website like Wordpress, then make a configuration like this for each domain.
domain1.com.conf domain2.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/example.com/public_html
<Directory /var/www/html/example.com/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Log file locations
LogLevel warn
ErrorLog /var/www/html/example.com/log/error.log
CustomLog /var/www/html/example.com/log/access.log combined
</VirtualHost>
To enable the configuration: sudo a2ensite doamin.com.conf, then restart the apache service.
run this sudo a2enmode rewrite to enable rewrite rules.
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.