By pedro71
I have followed the instructions here https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04 to create another virtual host on apache so that I could host two websites from one droplet. I have created a conf file is /sites-available/ like this:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName diffuse-mode.tk
ServerAlias www.diffuse-mode.tk
DocumentRoot /var/www/html2
<Directory /var/www/html2/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.diffuse-mode.tk [OR]
RewriteCond %{SERVER_NAME} =diffuse-mode.tk
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/diffuse-mode.tk/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/diffuse-mode.tk/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Here is the conf file for the original site:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName petersenglish.nyc
ServerAlias www.petersenglish.nyc
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/petersenglish.nyc/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/petersenglish.nyc/privkey.pem
</VirtualHost>
</IfModule>
These conf files were modified by letsencrypt. The other website, which was on there already before I tried to set up this one, already had a letsencrypt SSL certificate. I added one to the new site as well. Right now it is just a simple index.html file in html2. The original website is wordpress.
The problem is that when I go to diffuse-mode.tk, I get the following error from the browser:
**The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.**
At first, before I put in an A record for www, it would go to www.diffuse-mode.tk and say the site is not found.
How can I get diffuse-mode.tk to go to html2?
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 @pedro71,
There are a couple of things I believe you’ve done but nevertheless, please do try them again:
sudo a2ensite diffuse-mode.tk.conf
If the name of the configuration file is different make sure to change it in your command.
The second is to restart apache like so
sudo systemctl restart apache2
Now, if you are still experiencing the issue, make sure to check your website’s DNS. See if it’s pinging from the correct IP address.
If this doesn’t work out, try removing the following block from the website’s configuration file :
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.diffuse-mode.tk [OR]
RewriteCond %{SERVER_NAME} =diffuse-mode.tk
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
I believe this might be causing the issues. Don’t forget to restart apache after you make the changes.
Regards, KFSys
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.