Jiangyue Zhu

Impossible is Nothing

Configure Virtual Hosts–Use XAMPP

Leave a comment

By default, I can access to my localhost in http://localhost:8080/(my port sets to 8080) and the projects are deployed under htdocs folder.

But, how to change that? I read some posts online and find a way to do it for XAMPP.

Firstly, copy the following lines to C:\xampp\apache\conf\extra\httpd-vhosts:

<VirtualHost *:8080>
 DocumentRoot "C:/xampp/htdocs/zend/public"
 ServerName zend
 SetEnv APPLICATION_ENV development
<Directory "C:/xampp/htdocs/zend/public">
 Options Indexes MultiViews FollowSymLinks
 AllowOverride All
 Order allow,deny
 Allow from all
 </Directory>
</VirtualHost>

The port number is 8080. And the root directory is : “C:/xampp/htdocs/zend/public, which is my zend framework project application folder.

Also, I customize my host name as ‘zend’. So in this way. I can use http://zend:8080/ instead of http://localhost:8080/

But before open the browser, there is still one more thing to do:

Go to ‘C:\Windows\System32\drivers\etc’, and find open ‘hosts’.

Here, I edit another host by using the following contents:

127.0.0.1       localhost zend

After this configuration, don’t forget to restart the apache server.

Then it is the time to open the browser to try the new url:  http://zend:8080

and it will access the public/ directory.

Advertisements

Author: zhujy8833

Impossible is nothing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s