Issue with Deployment of new VHOST and additional characters to Document Root

General discussion on Zend Server for IBM System i
Post Reply
kingharrison
Posts: 28
Joined: Thu May 19, 2011 4:11 am

Issue with Deployment of new VHOST and additional characters to Document Root

Post by kingharrison » Tue May 22, 2018 8:02 pm

I am having issues where I am deploying a new VHOST with this code below:

Code: Select all

Listen ${port}

<VirtualHost *:${port}>

    # If this is a development environment uncomment the line below
    # SetEnv "APP_ENV" "development"
    
    DocumentRoot "${docroot}/public"
    ServerName ${vhost}:${port}

    # include the folder containing the vhost aliases for zend server
    # deployment for Apache 2.2
    # Include "${aliasdir}/*.conf"
    # include the folder containing the vhost aliases for zend server
    # deployment for Apache 2.4
    IncludeOptional "${aliasdir}/*.conf"

    RewriteEngine off
    <Location />
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^.*$ /index.php [NC,L]
    </Location>

ExpiresActive On
ExpiresByType image/png "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/x-javascript "access plus 1 day"
ExpiresByType image/x-icon "access plus 1 day"
ExpiresDefault "access plus 1 day"

</VirtualHost>
And now one of my servers will write out the document root line as such:

/usr/local/zendphp7/var/apps/http/10.6.49.11/8031/active//public

Notice the double //

Any ideas?

User avatar
zvika
Zend Global Support
Posts: 997
Joined: Sun Dec 14, 2008 9:48 am
Contact:

Re: Issue with Deployment of new VHOST and additional characters to Document Root

Post by zvika » Sun Aug 26, 2018 1:45 pm

Hello
There is a comment in the vhost template, added to newer version of Zend Server, due to override DocRoot restriction of the deployment mechanism when deploying applications to defined vhosts
# DocumentRoot should always be set to ${docroot}

The ZPK (Zend / Zipped Package) describes the document root in the deployment.xml, and the vhost definition is sort of "generic" when it comes to setting it up - you have the option to use defaults and .htaccess to add stuff, or the includes, or embed additional directives.

Once you deploy a ZPK, the DocumentRoot changes to include the app version and hash.

I would recommend to keep from touching the ${docroot} definition and use symlinks if hosting from a different directory, or use native ZPK deployment and set the public folder in the deployment.xml.

From what I remember, if you add the /public or other extra path to the docroot without a separating slash, it would create another docroot_public and point it to the default docroot dir.

Also - do you set <Directory> section in the vhost?

Let me know if this helps.
Zvika Dror
Zend Support Team

Post Reply