Jump to content

Zend Server CE & Virtual Hosts (help Gurus)


2levelsabove

Recommended Posts

I have a working copy of Zend Server CE and am trying to set up some virtual hosts and it does not seem to be working. $_SERVER['DOCUMENT_ROOT'] is not pointing correctly and that is making my live server scripts break.

 

 

I have the following in my vhosts file:

 

<VirtualHost 127.0.0.1:80>
  DocumentRoot D:/zend_server_ce/Apache2/htdocs/
  ServerName localhost
</VirtualHost>


<VirtualHost http://localhost/domain.com>
  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.com"
  ServerName http://localhost/domain.com

  CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.com\logs\access.log" combined
  ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.com\logs\error.log"

  <Directory "D:\zend_server_ce\Apache2\htdocs\domain.com">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

 

 

Link to comment
Share on other sites

A bit more information would help, such as where is your DOCUMENT_ROOT pointing to?

 

As far as I know the <Directory> directive requires a tailing slash:

 

<Directory "D:\zend_server_ce\Apache2\htdocs\domain.com\">

 

But I have never really quite seen a vhost file setup like what you have pasted, but I have never used Zend Server CE either.

Link to comment
Share on other sites

Thanks for the reply. The Vhost set up should be very standard and I am just using examples I saw on the web. The document root that you is an actual one and instead of domain.com I have the websitename.com.

 

As far as I understand, the vhost setup does not need to be any different from lets say xamp.

 

Link to comment
Share on other sites

Did you try adding the trailing slash as I suggested? Did that not work?

 

If the DOCUMENT_ROOT is pointing to "D:\zend_server_ce\Apache2\htdocs\domain.com\" what is the problem? IE how is it not pointing correctly?

 

Since it is not "pointing correctly" perhaps it is your code that is flawed and not your vhosts declaration? There are too many variables here, given that you said it breaks on the live server. That says that you are probably working on different PHP Versions with different php.ini files and or the code does some compensation for the localhost server and they do not jive.

 

The first thing first, how does the live server break? What are the symptoms of it? Are you sure it is not just how the code is programmed?

Link to comment
Share on other sites

Ah. The issue is that you are using "localhost" whose documentroot is what you just posted above.

 

To fix it, why not access your content via domain.dev here is an example vhost directory:

 

<VirtualHost *:80>
  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.com"
  ServerName domain.dev www.domain.dev *.domain.dev

  CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined
  ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log"

  <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

 

Then you will need to modify your hosts file. For windows it is located:

C:\Windows\system32\drivers\etc\hosts

 

Add this to it:

127.0.0.1    domain.dev

 

Reload apache, perhaps do a Start->Run-> gpupdate /force

 

Then open up your browser type in domain.dev and it should work just fine, with the correct document_root.

Link to comment
Share on other sites

[17-Mar-2010 10:56:44] PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'D:/zend_server_ce/Apache2/htdocs/includes/_process/pagesecurity.php' (include_path='.;D:\zend_server_ce\ZendServer\share\ZendFramework\library') in D:\zend_server_ce\Apache2\htdocs\domain.com\dashboard.php on line 2

Link to comment
Share on other sites

Actually I had a mistake and now I put in your code properly:

 

<VirtualHost *:80>

  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev"

  ServerName domain.dev www.domain.dev *.domain.dev

 

  CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined

  ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log"

 

  <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\">

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

  </Directory>

</VirtualHost>

 

Now when I go to domain.dev, the site does not pull up

 

Do I need to make any changes to my windows host file?

 

 

Link to comment
Share on other sites

Do I need to make any changes to my windows host file?

 

Then you will need to modify your hosts file. For windows it is located:

C:\Windows\system32\drivers\etc\hosts

 

Add this to it:

Code: [select]

127.0.0.1    domain.dev

Reload apache, perhaps do a Start->Run-> gpupdate /force

Link to comment
Share on other sites

Sorry, I may have mis-done the vhosts file. Modify it like so:

 

<VirtualHost *:80>
  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev"
  ServerName domain.dev 
  ServerAlias www.domain.dev *.domain.dev domain.dev

 

Remember to do an apache reload after that has been done.

Link to comment
Share on other sites

I know i need to buy you lunch and a beer on St Patricks.  I still cannot pull up domain.dev

 

OK here are the contents of my vhosts file:

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "d:\zend_server_ce\Apache2/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "d:\zend_server_ce\Apache2/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>



<VirtualHost *:80>
  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev"
  ServerName domain.dev
  ServerAlias www.domain.dev *.domain.dev domain.dev

  CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined
  ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log"

  <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


 

 

I have the following in my windows hosts file:

 


# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1 localhost
127.0.0.1 domain.dev
::1             localhost

 

 

I still cannot get domain.dev as it says

 

 

Zend Server Test Page

 

Zend Server is now up and running on this server. Once content is added this message will no longer be displayed.

If you are this server's administrator:

 

You can now add content to your Web server's document root. You can configure and control your Zend Server installation through the Zend Server Administration Interface. Please refer to the documentation or to your installation's README file for more information.

 

If you need help getting started with Zend Server, please visit the on-line resources page.

 

For more information about Zend Server you are welcome to visit us at www.zend.com.

 

Link to comment
Share on other sites

Ok, just to make sure settings took place, try and reboot the computer. This should ensure that apache gets the new settings as well as the gpupdate.

 

Also make sure that in the httpd.conf the vhosts include is uncommented out. I would comment out or remove the dummy vhosts from the vhosts file as well. Give those a try and see what comes of it.

Link to comment
Share on other sites

Sorry for the late reply. Got stuck at work.

 

Any how in httpd.conf the vhosts was commented so I uncommented it. Thanks so much for the tip.

 

Now the Apache server wont even start.

 

The contents of my vhosts file are:

 


#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.



<VirtualHost *:80>
  DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev"
  ServerName domain.dev
  ServerAlias www.domain.dev *.domain.dev domain.dev

  CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined
  ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log"

  <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

 

 

something in there is causing Apache to not start

Link to comment
Share on other sites

Not sure if this is it, but try removing the "s around the Document Root, you should also try and use the apachectl tool which you can run via command line with the -f path/to/vhosts/file to determine where the syntax error is.  You may also try removing domain.dev from the server alias, it should not matter, but may.

Link to comment
Share on other sites

OK so made some progress. This works however when I hover over links, they still show http://localhost/domain.dev

 

<VirtualHost *:80>
  DocumentRoot D:\zend_server_ce\Apache2\htdocs\domain.dev
  ServerName domain.dev
  ServerAlias www.domain.dev *.domain.dev domain.dev
  #CustomLog D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log
# ErrorLog D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log

  <Directory D:\zend_server_ce\Apache2\htdocs\domain.dev>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

 

 

I know I am close but not quite there.

Link to comment
Share on other sites

Is this declaration

<VirtualHost http://localhost/domain.com>

 

Still in your httpd.conf file at all? If so remove it. Other then that check your file and make sure that your links are not setup to that location.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.