Confused with Zend Server Configuration
I have installed Zend server and developed a sample application, and iam surprised when my ap开发者_JAVA技巧plication url could not open in the browser...
This is my url, related to my zend application:
http://localhost/app_name/public/controller/action/parameter
I got an error like: "The requested URL /app_name/public/controller/action/parameter was not found on this server".
When i read the quickstart guide from here, i learnt that i had to define a VirtualHost directive inside my httpd.conf file of Apache directory.
But to my surprise, i found the following lines already existing in my httpd.conf file:
DocumentRoot "C:\zend\Apache2/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Could not understand what to do...
First of all , your document root was wrong.You are using forward and backward slash at the same time and accessing the localhost will take you to the htdocs not the virtual host.
Please follow these steps to create a virtual host or check your setting with these
- Create a virtual hosts
<VirtualHost *:80> ServerName cert.local DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public" <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Register with your operating system (for windows)
Go to c:\WINDOWS\system32\drivers\etc and add the following line
127.0.0.1 cert.local
Restart the apache server and in order to access the virtual host go to http://cert.local/
If you want to access the htdocs and zend at the same time then you have to create another virtual host pointing to the htdocs.
Here is some basic about Virtual hosting
http://httpd.apache.org/docs/2.2/vhosts/
Hope this will help..:)
Got it... In the VirtualHost definition mentioned in the quickstart guide in the above link, the DocumentRoot and Directory were configured to the quickstart application, and if the document root was mentioned only till "htdocs" by default (not till application name/public), the zend format url doesn't work.
As i have many zend applications in my htdocs, i had to make the paths of DocumentRoot and Directory till "htdocs" itself, as it will vary in future for each application. So i added the following lines in my httpd.conf file, to make my app url work. Now i can run any zend application without modifying the httpd.conf file.
(and i also had to tell to the client to add these lines in his httpd.conf file for testing the application :)
<VirtualHost *:80>
<Directory C:\zend\Apache2\htdocs\>
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
Hope it helps someone.
精彩评论