Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: Virtual hosts - Everything was OK before I add a second site | 
 |   
| Author | 
  | 
 
Ewsg
 
 
  Joined: 07 Mar 2023 Posts: 1
 
  | 
 Posted: Tue 07 Mar '23 15:48    Post subject: Virtual hosts - Everything was OK before I add a second site | 
     | 
 
  | 
 
Hello there!
 
 
I would love to count with your help if possible.
 
 
I am experiencing an issue here with my Linux/Apache server.
 
 
I had one website hosted until yesterday, using virtual host. So I've added a second website, and things started going wrong.
 
 
Well, the first website is ok, but the second one is not loading. I can see only a blank page. And it's a WordPress site, it's important to note, I think.
 
 
I can check the logs (access and error) but can't decide what is wrong or not.
 
 
Also, I am posting both virtual hosts files so you could take a look and maybe try to see what is wrong, if possible:
 
 
Vhost site 1
 
 
 	  | Code: | 	 		  <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 domain1.com
 
        ServerAlias www.domain1.com
 
 
        Protocols h2 http/1.1
 
 
        ServerAdmin webmaster@localhost
 
        DocumentRoot /var/www/html/domain1.com/public_html
 
 
         <Directory /var/www/html/domain1.com/public_html>
 
         Options -Indexes +FollowSymLinks
 
         AllowOverride 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 /var/www/html/domain1.com/logs/error.log
 
        CustomLog /var/www/html/domain1.com/logs/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
 
<Location /server-status>
 
     SetHandler server-status
 
     Order Deny,Allow
 
     Deny from all
 
  Allow from localhost
 
</Location>
 
RewriteEngine on
 
RewriteCond %{SERVER_NAME} =www.domain1.com
 
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
 
  <Directory /var/www/html/domain1.com/public_html/>
 
        Require all granted
 
        AllowOverride All
 
    </Directory>
 
</VirtualHost> | 	  
 
 
Vhost site 2:
 
 
 	  | Code: | 	 		  <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 domain2.com
 
        ServerAlias www.domain2.com
 
 
        Protocols h2 http/1.1
 
 
        ServerAdmin webmaster@localhost
 
        DocumentRoot /var/www/html/domain2.com/public_html
 
 
         <Directory /var/www/html/domain2.com/public_html>
 
         Options -Indexes +FollowSymLinks
 
         AllowOverride 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 /var/www/html/domain2.com/logs/error.log
 
        CustomLog /var/www/html/domain2.com/logs/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
 
RewriteEngine on
 
RewriteCond %{SERVER_NAME} =www.domain2.com
 
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
 
</VirtualHost> | 	  
 
 
Well, I would really appreciate any help because I am a little lost here.  
 
 
Thanks in advance. | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |