Monday, May 22, 2017

linux - Unable to visit virtual host over port 443

I have a Google Compute instance (Debian 8 and Apache) running using Google Compute protocol forwarding to be able to use multiple external IP addresses with one virtual machine instance:





Google Compute Protocol Forwarding (full article)



Google Compute Engine supports Protocol Forwarding, which lets you
create forwarding rule objects that can send packets to a non-NAT’ed
target instance. Each target instance contains a single virtual
machine instance that receives and handles traffic from the
corresponding forwarding rules.





The Problem



I am not able to visit one of the virtual host domains/IP's over port 443. I need this, because I want to enable HTTPS on all these domains.



I have tried multiple options to achieve opening port 443, but none of them works:



Option 1) Virtual name-based hosts:



/etc/apache2/ports.conf




Listen 80


NameVirtualHost *:443
Listen 443



NameVirtualHost *:443

Listen 443



/etc/apache2/sites-enabled/example.com.conf




ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/website1




ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/website1



Option 2) Virtual IP-based hosts:




/etc/apache2/ports.conf



Listen 80


NameVirtualHost *:443
Listen 443




NameVirtualHost *:443
Listen 443



DocumentRoot /var/www/website1

Require all granted




...


Both options work for port 80, but not for port 443.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...