Score:0

Trouble add second site to apache2

za flag

I'm running Apache2 on a VPS running ubuntu 20.04. I have a site up and working let call it linuxtom.com. I'm trying to add a second site lets call it ponytattoomachine.com. I've made the virtual host for ponytattoomachine called ponytm.conf in /etc/apache2/sites-available and I've made it as simple as possible

<VirtualHost *:80>

ServerName ponytattoomachine.com

DocumentRoot /srv/www2/

</VirtualHost>

and the 1st working site is

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName linuxtom.com
ServerAlias www.linuxtom.com
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =linuxtom.com [OR]
RewriteCond %{SERVER_NAME} =www.linuxtom.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Then I enable site with a2ensite ponytm.conf and all run ok. Then I reload apache2. When I try to go to ponytattoomachine.com site it just takes my to linuxtom.com, which is my finished wordpress site. Its not showing my my index.html for ponytattoomachine which is located in /srv/www2/. The one thing I can think of that may be causing the problem is that I have SSL enabled for linuxtom.com. I don't know how it was all enabled as I just let certbot do its magic. I don't have an SSL yet for ponytattoomachine.com yet as I was waiting until I had a page that certbot could verify. I've set the owner of the file permissions to www-data so I doubt its a permission issue for accessing /srv/ww2/index.html. I'm at a loss of what to try next. Also one thing to note is when I a2dissite my wordpress site and its SSL counter part and just have ponytm.conf enabled and try to go to ponytattoomachine.com it does not load and my URL still changes to linuxtom.com. Thanks

in flag
Silly question, but what flavour of Linux are you running? The document root for your Apache sites are not standard for Ubuntu
cn flag
Are you going to http://ponytattoomachine.com or http**s**//ponytatoomachine.com? The latter will not work because you have only set up HTTP, not HTTPS. What does "apachectl -t -D DUMP_VHOSTS" show?
Tom A. avatar
za flag
I got it figured out thanks to some help. I had 2 issues. One was chrome was caching my 1st web site and not showing me the 2nd problem. Lynx showed me I did not have access in apache for /srv/ww2. By adding a``` <Directory /srv/www2/> Options FollowSymLinks Require all granted </Directory>``` to the virtual host i was able to see my 2nd site in lynx. Clearing the cache in crome let me see it chrome.
Score:1
za flag

I got it figured out thanks to some help. I had 2 issues. One was chrome was caching my 1st web site and not showing me the 2nd problem. Lynx showed me I did not have access in apache for /srv/ww2. By adding a

<Directory /srv/www2/> 
      Options FollowSymLinks 
      Require all granted 
</Directory>

to the virtual host i was able to see my 2nd site in lynx. Clearing the cache in crome let me see it chrome.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.