Simultaneous Deployment to HTTP and HTTPS Virtual Hosts in Zend Server

Follow

Issue

In some setups an application is being served both through HTTP and HTTPS protocols. However, the current version of Zend Server does not provide an easy way of simultaneous application deployment or update to multiple Virtual Hosts.

This article explains how this limitation can be worked around.

Environment

Zend Server 7, 8.5.x

Apache web server

Resolution

To deploy an application to HTTP and HTTPS Virtual Hosts simultaneously, these Virtual Hosts need first to be created. You should start off as you would normally do when creating an HTTPS (SSL) Virtual Host.

 

 

 

Choose to use a custom Virtual Host template. The custom template needs to include both HTTP and HTTPS Virtual Hosts. Here is an example of such a template:

### Double VHost Template

<VirtualHost *:443>

    DocumentRoot "${docroot}"
    <Directory "${docroot}">
        Options +Indexes +FollowSymLinks
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        AllowOverride All
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile "${certificate_file}"
    SSLCertificateKeyFile "${certificate_key_file}"
    SSLCertificateChainFile "${certificate_chain_file}"

    ServerName ${vhost}:443
    
    # include the folder containing the vhost aliases for zend server deployment
    IncludeOptional "${aliasdir}/*.conf"
    
</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "${docroot}"
    <Directory "${docroot}">
        Options +Indexes +FollowSymLinks
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        AllowOverride All
        Require all granted
    </Directory>

    ServerName ${vhost}:80
    ServerAlias www.new-new-vhost.lcl
    
    # include the folder containing the vhost aliases for zend server deployment
    IncludeOptional "${aliasdir}/*.conf"
    
</VirtualHost>

Note, the port numbers need to be specified explicitly, not through the '${port}' placeholder.

Upon completing the Virtual Host creation wizard and restarting Zend Server, you should see two new Virtual Hosts in the list:

Unfortunately, since Zend Server does not natively support such setups, there are two limitations:

1. You should deploy your applications only to the SSL Virtual Host.

2. After the first application's deployment, the HTTP virtual host will appear in the Warning state. This is the expected behavior and you need to ignore this warning.

Details

Besides the aforementioned limitations, we are currently unaware of any additional downsides to using this method.

Like in the template example above, you can use the ServerAlias directive for alternative server names.

 

 

 

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk