Reputation: 145
I have an AWS EC2 server with a website that is pointing to 5 different sub-domains. 3 subdomains are on CodeIgniter 3.x php. 1 is using Laravel 5.6 php and 1 is using React JS. Wild Card SSL is configured for all these websites.
A couple of these are expected to receive huge traffic for few weeks every 2-3 months, which prompts to configure a Load Balancer by adding additional servers to balance the load.
Let's name them
ci1.example.com
, ci2.example.com
, ci3.example.com
lv.example.com
reactapp.example.com
The traffic is expected on reactapp.example.com
which is served in association with lv.example.com
.
the httpd.conf
entries are like this.
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/ci1/
ServerName ci1.example.com
CustomLog "/var/log/httpd/ci1_access.log" combined
ErrorLog "/var/log/httpd/ci1_error.log"
RewriteEngine on
RewriteCond %{SERVER_NAME} =ci1.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Similar entries for subdomains ci2
, ci3
, lv
and reactapp
exist.
BTW, I have tried removing ServerName
directive and changed the port to 443
. Also, tried keeping only one VirtualHost
something like below just to see if I can achieve it at least for one subdomain.
<VirtualHost *:443>
DocumentRoot /var/www/html/reactapp/
<Directory /var/www/html/reactapp/>
Options +Indexes
AllowOverride All
</Directory>
CustomLog "/var/log/httpd/reactapp_access.log" combined
ErrorLog "/var/log/httpd/reactapp_error.log"
</VirtualHost>
So far, no luck. Always a blank page is displayed with no error log. If ServerName
directive is added, the site is coming up. But, httpd
access log is getting populated in all servers added to the target group.
Any suggestions would be highly appreciated.
Upvotes: 0
Views: 35
Reputation: 429
Assuming all your requests will come from the same address, you can add in your VirtualHost
a ServerAlias
parameter (you can define multiples for the same virtualhost), so the load balancer will redirect to the same address and the server can answer.
https://httpd.apache.org/docs/2.4/mod/core.html#serveralias
Upvotes: 0