This article is now available in our new knowledge base: Port settings for virtual host deployed on IBM i
Deploying a new name-based virtual host using Zend Deployment on the IBM i makes it very easy to specify the new virtual host. However, if the new virtual host uses a port other than the default application port of 10080, there are a couple of directives that need to be manually added to the Apache configuration.
Zend Server for IBM i version 6.2 or later, running on any supported version of IBM i.
Note: Windows users may be interested in this related article:
Vhost With Custom Port Does Not Add "Listen" Directive
When setting up a new Virtual Host using deployment (Applications -> Virtual Hosts tab in Zend Server UI), you can specify a new port. You need to add the Listen and NameVirtualHost directives to support the new port in the /www/zendsvr6/httpd.conf configuration file.
Note: Never use port 10081 or 10083. These ports are reserved for internal Zend Server use.
Perhaps the easiest way to edit the Apache configuration file is in the IBM Web Administration for i utility . The HTTP Server to select is ZENDSVR6. You can also edit file /www/zendsvr6/httpd.conf in a text editor like Zend Studio.
A common use for adding a different port is to use port 80, the standard port for web pages, or 443, the standard port for web pages using SSL. In this example we will add port 443 to the Apache configuration. This can be done either before or after the new virtual host is added. It is better to add the port to the Apache configuration first, so that the virtual host will be useable as soon as it is added.
In the ZENDSVR6 Apache configuration, find the existing directives for 10081 and 10080:
Add the two new directives just below the existing ones, so now the section will look like this:
# Add port 443
Restart the ZENDSVR6 instance of Apache for this change to take effect.
Something else you might need to do
If you are adding a port that is also used by another Apache or other TCP server, you might need to specify an ip address as well as the port, to make the Listen unique. This might be true if you want to add something like 80 or 443 (the standard http and https ports), and those ports are used on other servers. It is possible to have two Apache instances listening on the same port. the trick is that your IBM i needs to have two different ip addresses assigned, and each server must listen on a unique ip address. This article will not go into the details on how to set this up. Your Network Administrator should set this up for you, and then tell you which ip address to use for your new virtual host.
In this example, the Network Administrator has asked us to use ip address 192.168.19.203 and port 443.
Then you would make it look like this (example ip and port 192.168.19.203:443):
#Add port 443
You also have to fix the template for the virtual host to show the ip address, which you will be able to do during the Virtual Host Deployment, or afterwards using the editor. Change this:
Of course, the other Apache instance will also need to be set up to listen to its own ip address.