I have two domains and one IP. Both domains listen on port 80. Also on port 443 listen one of the domains (from these two). But there is also possibility to access one of the domains only by IP. I blocked the IP on port 80 and this is fine. Problem now is, that using https (port 443) and IP anyone can access page from one of the domains. How can I separate two domains from IP access?
domain1 listens on 80 only - this is ok domain2 listens on 80 and 443 - this is ok IP listens on 80 and 443 but must be blocked - don't know how to set it
There is set one VirtualHost for 443, but trying the second is not accepted by apache. Everything is set on apache2 working on Raspberry Pi (Raspbian).
What I have is:
ServerName localhost NameVirtualHost *:80 Listen 80 <IfModule mod_ssl.c> NameVirtualHost *:443 ServerName 1st_domain.pl Listen 443 </IfModule>
<VirtualHost *:80> ServerName my.ip.address.here ServerAlias my.ip.address.here <Directory /*> Deny from all </Directory> </VirtualHost>
<VirtualHost *:80> ServerName 1st_domain.pl ServerAlias www.1st_domain.pl ... </VirtualHost> <VirtualHost *:443> ServerName 1st_domain.pl ServerAlias www.1st_domain.pl ... SSLEngine on SSLCertificateFile ...crt SSLCertificateKeyFile ...key </VirtualHost>
<VirtualHost *:80> ServerName 2nd_domain.pl ServerAlias www.2nd_domain.pl ... </VirtualHost>