Creating Virtual Host with Webcache and HTTP-server.

Not that high-tech, but takes quite a lot of small steps, and must be done without taking risks in a production environment. I did this with Enterprise Manager, while I did not completely rely on  my abilities on updating the $ORACLE_HOME/webcache/webcache.xml ….. , and eventually I had to hand it over to the production-DBA.

Example: vhost.domain.nl on the server  ‘myhost’.
Goal: make the webcache also listen on port 80 (besides the default 7779) and connect the incoming request to the http-server on port 8000.

1. Preparation to make the webcache listen on port 80. All ports under 1024 is managed by the  user root, so it needs to be changed:
– take the webcache down (through enterprise manager: middle.myhost.domain.nl –> Web Cache, radio button, stop)
– connect  as root (or through “su -“)
– set the right environment (you need $ORACLE_HOME !)
– cd $ORACLE_HOME/webcache/bin
– ls -al webcached  –> shows that the owner is oracle.
– “./webache_setuser.sh setroot oracle”
– ls -al webcached  –> should show the owner is root.
– startup the webcache.

2. Let the webcache listen on port 80.
Through Enterprise manager:
– middle.myhost.domain.nl –> Web Cache, tab Administration.
– choose Ports
– under ‘Listen Ports’ –> Add a row.
– IP Address: *
– Port: 80
– Protocol: HTTP
– restart the webcache.

3. Put the virtual hosts in de /etc/hosts of the node “myhost”:

194.13.16.125      vhost.domain.nl vhost
194.13.16.125      catchall.domain.nl catchall

The second virtual host I use in this case as a workaround for catching all the requests on poort 8000 which are not for the virtual host ‘vhost.domain.nl. The startup-page of Apache will be showed.This virtual host must be the first in httpd.conf (port 8000) by the way.
This can also be done in the configuration of webcache by the way I’ve been told…

4. Make the http-server listen on port 8000.

– Enterprise Manager : middle.myhost.domain.nl > HTTP-Server > Administration > Server Properties
– ‘Listening Addressen and Ports’ : Add Another Row.
– Listening IP Address: empty
– Listening Port : 8000
– apply.
– restart HTTP_Server

5. Create the virtual hosts in HTTP-Server.

– middle.myhost.domain.nl > HTTP_Server > Virtual Host.

– Create Virtual Host.
– Server Name: catchall.domain.nl
– Document Root: default -> /software/oracle/middle/Apache/Apache/htdocs
– Administrator E-mail : me@domain.nl
– IP Address: Listen on all the main server IP addresses
– Listening Ports : 8000
– Error Log Path : default
– Select Clent Access Log Filename: default

– Create Virtual Host.
– Server Name: vhost.domain.nl
– Document Root: default -> /software/oracle/middle/Apache/Apache/htdocs
– Administrator E-mail : dba@domain.nl
– IP Address: Listen on all the main server IP addresses
– Listening Ports : 8000
– Error Log Path : default
– Select Clent Access Log Filename: default

6. Adding an ‘Origin Server’ in Webcache (myhost – http-server: poort 8000)

– middle.myhost.domain.nl > Web Cache > Administration > Origin Servers
– Create
– Host: myhost.domain.nl
– Port: 8000
– Rest: default
– Restart the webcache

7. Maken the virtual host known with the Webcache, and redirect it to the origin server:

– middle.myhost.domain.nl > Web Cache > Administration > Sites
– Named Sites Definitions: create
– Host: vhost.domain.nl
– Port: 80
– select at  available Origin Servers: myhost.domain.nl:8000
– Move this to the selected Origin Servers.

8. Modify the virtual host e.q. for the log-files

– In Enterprise Manager : middle.myhost.domain.nl > HTTP-Server > Administration > Advanced Server Properties
– Open httpd.conf
– Go to the  virtual host “vhost.domain.nl”
Shows a lot like this:
—————-
Listen 8000

<VirtualHost *:8000>
ServerAdmin dba@domain.nl
ServerName vhost.domain.nl
</VirtualHost>
————————-

Put the following lines in the Virtual Host (do not use cut/paste from wordpad/notepad !!!):

ErrorLog “|/software/oracle/middle/Apache/Apache/bin/rotatelogs /software/oracle/middle/Apache/Apache/logs/vhost_error_log 43200″
CustomLog “|/software/oracle/middle/Apache/Apache/bin/rotatelogs /software/oracle/middle/Apache/Apache/logs/vhost_access_log 43200″ common

9. Test it  while the DNS is not set yet:

To test it you can put the vhost in your host-file of your client  (C:\WINDOWS\system32\drivers\etc\hosts):

194.13.16.127    vhost.domain.nl vhost

m4s0n501