Configuring Virtual Host - Keep Seeing Test Page

General discussion forum for the Zend Server
Post Reply
engineer-labs
Posts: 7
Joined: Sun Dec 02, 2012 6:22 am

Configuring Virtual Host - Keep Seeing Test Page

Post by engineer-labs » Sun Dec 02, 2012 6:34 am

I'd appreciate a working solution for this:

Virtual host doesn't seem to work as I keep seeing the Zend Server Test Page. I have one virtual host (http://sandbox.loc) and the main host (http://localhost).

Using version Zend Server CE 5.6.1 (Full Installation) & Windows 7 Ultimate (x64).

Uncommented: "Include conf/extra/httpd-vhosts.conf" in httpd.conf. Apache is listening at Port 80.

Below is a snippet of my httpd-vhosts.conf:

Code: Select all

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "C:\Program Files (x86)\Zend\Apache2\htdocs"
    <Directory "C:\Program Files (x86)\Zend\Apache2\htdocs">
        Order Allow,Deny
        Allow from All
    	 AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName sandbox.loc
    DocumentRoot "C:\Program Files (x86)\Zend\Apache2\htdocs\sandbox"
    <Directory "C:\Program Files (x86)\Zend\Apache2\htdocs\sandbox">
        Order Allow,Deny
        Allow from All
    	 AllowOverride All
    </Directory>
</VirtualHost>
Now my "hosts" file:

Code: Select all

127.0.0.1    	localhost
::1    	      localhost
127.0.0.1    	sandbox.loc
Apache was restarted after these changes.

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

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by zvika » Sun Dec 02, 2012 1:39 pm

Hi
[UPDATE] - If you meant to use a hostname, pay attention that your vhost sample has localhost and not a custom hostname.

Do you mean you see this page? - 'file:///C:/Program Files (x86)/Zend/Apache2/htdocs/index.html' (open in browser)
Rename, Remove or Replace.
Zvika Dror
Zend Support Team

derokorian
Posts: 4
Joined: Tue Nov 27, 2012 1:53 am

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by derokorian » Sun Dec 02, 2012 4:25 pm

Make sure your files are properly saving. I had this problem, I solved it by saving the httpd.conf and httpd-vhost.conf to my Documents library, made my changes and saved again, and finally copied them back to the original location and this worked perfectly. Lastly don't forget to restart apache, I was able to do this using the apache monitor utility from the notification area.

engineer-labs
Posts: 7
Joined: Sun Dec 02, 2012 6:22 am

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by engineer-labs » Mon Dec 03, 2012 1:51 am

That did the trick! Thanks a lot derokorian.

Its a bit odd though that editing these files in their original locations doesn't have an effect on the vhost configuration.

Saving it to a folder outside reverts the contents back to its original. Is this a Windows-permissions thing?

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

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by zvika » Mon Dec 03, 2012 11:35 am

I am not sure what the problem with adding vhosts is.

I tested Zend Server 5.6 PHP 5.3 on Windows 7 64-bit.
I'm using a domain user which is a local admin, similar to using Administrator account or a local user who is also in the Admin group.
If there is doubt about user privileges, you might right-click and run as Administrator (open the editor first and load the text file so you open/save with Admin privileges).

I grabbed the ZF2 Skeleton App off github, but you can place any PHP script on any document root to check.

I commented out the extra/vhosts.conf in httpd.conf.

Next, I edited vhosts.conf and added a virtual host pointing to the public dir of the project:

Code: Select all

<VirtualHost *:80>
    ServerAdmin my-email@zend.com
    DocumentRoot "D:\Data\Workspaces\ZendStudio10\ZF2-SkeletonApp\public"
    ServerName zf2-skeleton
    ErrorLog "logs/zf2-skeleton-error.log"
    CustomLog "logs/zf2-skeleton-access.log" common
	<Directory "D:\Data\Workspaces\ZendStudio10\ZF2-SkeletonApp\public">
		Order Allow,Deny
		Allow from all
	</Directory> 	
</VirtualHost>
To load the new vhost configuration, Restart Apache using the Apache Monitor, or you can execute from console:
> net stop Apache2.2-Zend
> net start Apache2.2-Zend

To get to the named vhost, I added an entry to the hosts file at "C:\Windows\System32\drivers\etc\hosts"
127.0.0.1 zf2-skeleton

Now open the browser at "http://zf2-skeleton/" and see the new vhost in action.
Zvika Dror
Zend Support Team

engineer-labs
Posts: 7
Joined: Sun Dec 02, 2012 6:22 am

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by engineer-labs » Tue Dec 04, 2012 12:13 am

Most likely it is an issue involving permissions although I edited the conf files as admin in the installation directory.

Probably its not a good idea to edit it there as suggested by derokorian.

engineer-labs
Posts: 7
Joined: Sun Dec 02, 2012 6:22 am

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by engineer-labs » Sat Dec 15, 2012 8:45 am

There is another strange behavior:

Somehow the contents httpd-vhosts.conf file reverts back to its original state (i.e. no vhosts configured). This happens after restarting my PC.

Does anyone also encounter this problem?

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

Re: Configuring Virtual Host - Keep Seeing Test Page

Post by zvika » Sun Dec 16, 2012 11:54 am

Hi

This is an unlikely behavior - can be a bug or some specific setup / restore feature on your Windows.

If you can replicate the issue on a clean Windows without any special application - please open a support case so we can investigate.
On the other hand - if you find a special 3rd party application which causes this - please mention it here for reference to other Zend Server users.
Zvika Dror
Zend Support Team

Post Reply