APACHE SSL
IP Based Hosting (APACHE + SSL)
<SERVER>
1) Go to SSL Configuration File.
# vim /etc/httpd/conf.d/ssl.conf
<In
Global Section>
Listen
192.168.0.102:443
Listen
192.168.0.104:443
<In
Virtual Host_1>
<VirtualHost
192.168.0.102:443>
DocumentRoot
“/opt/viplav”
ServerName
192.168.0.102:443
</VirtualHost>
<In
Virtual Host_2>
<VirtualHost
192.168.0.104:443>
DocumentRoot
“/opt/funny”
ServerName
192.168.0.104:443
</VirtualHost>
(We
can keep separate “Certificate” and “key” file for both websites.)
2) /etc/init.d/httpd reload
<CLIENT>
1) Make entry in “/etc/hosts”
# vim /etc/hosts
192.168.0.102 first.com
192.168.0.104 second.com
:wq
2) Open Browser and access website.
SCENARIO – 1
Suppose you have a Website which is running in “http” and you
want to run it in “https”.
<SERVER>
1)
In normal configuration file add below line.
#
vim /etc/httpd/conf/httpd.conf
<In
Virtual Host>
Redirect
/ https://first.com (No need of “DocumentRoot”)
:wq
(Because
it picks the “DocumentRoot” from “ssl.conf”)
2)
Make entry of “https://first.com” in “ssl.conf”
SCENARIO - 2
How to host website?
Whenever
we want to host any website, make entry in both files i.e. “ssl.conf” &
“httpd.conf”. Because you never know, what client enters in browser i.e. “http”
or “https”?
Comments
Post a Comment