Thursday 3 April 2014

Oracle OHS 2 VirtualHost domains on the same port with different RewriteRules

#Ensure the listening port
Listen 80
#Name the virtualhost
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domaindns1
ServerAlias domaindns1
RewriteEngine On
  RewriteOptions inherit
RewriteRule ^/$ /webcenter/spaces/Space1Name[PT,L]
RewriteRule ^/webcenter$ /webcenter/spaces [PT,L]
RewriteLog /home/oracle/rewrite.log
<Location />
  SetHandler weblogic-handler
        WebLogicCluster WCSSERVER:8888
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName domaindns2
ServerAlias domaindns2
RewriteEngine On
  RewriteOptions inherit
RewriteRule ^/$ /webcenter/spaces/Space2Name[PT,L]
RewriteRule ^/webcenter$ /webcenter/spaces [PT,L]
RewriteLog /home/oracle/rewrite.log
<Location />
  SetHandler weblogic-handler
         WebLogicCluster WCSSERVER:8888
</Location>
</VirtualHost>

Add the DNS to the /etc/hosts
sudo nano /etc/hosts

Then add the following two lines
127.0.0.1               domaindns1 domaindns1 
127.0.0.1               domaindns2 domaindns2 

Then
Sudo ./opmnctl stopall

Sudo ./opmnctl startall

If you do not "super user do" stop and then start opmnctl you will receive the following error
(13)Permission denied:  make_sock: could not bind to address 0.0.0.0:80