For the sake of simplicity we are using name-based
hosting. Once setup we should be able to access our separate development stages with URL's like http://placesdev/
and http://places-stage/.
As an aside, Zend Framework uses mod_rewrite to direct all requests via the front controller file. Combine
that with its routing functionality and you increase the possibilities of errors resulting from path issues. Setting
up virtual hosts is one way to reduce the time wasted on path problems as http://127.0.0.1/~places-dev
becomes http://places-dev/
Licensed to Menshu You
Zend Framework in Action (Ch01) Manning Publications Co. 4
Setting up the hosts file
The hosts file stores the information that maps the hostname to an IP address. As mentioned above name-based
hosting uses a single address for multiple names so looking at the hosts file in /etc/hosts we have the following
entry:
127.0.0.1 places-dev
127.0.0.1 places-stage
The names places-dev and places-stage are both being mapped to the localhost IP address 127.0.0.1
meaning that any requests this machine gets for those names will be directed to its own web server. Rather
than attempt to configure a full domain name system (DNS), we're also going to configure the hosts file of one
of the networked machines to point the same names to the IP address of the host machine:
192.
Pages:
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282