开发者

How do I access localhost ports on a virtual pc?

开发者 https://www.devze.com 2023-01-05 04:50 出处:网络
I\'ve downloaded and installed the Microsoft Virtual PC and Windows XP mode image for testing IE6. I have several projects on localhost that I access by port numbers in my vhosts file, for example:

I've downloaded and installed the Microsoft Virtual PC and Windows XP mode image for testing IE6. I have several projects on localhost that I access by port numbers in my vhosts file, for example:

Listen *:82
<VirtualHost *:82>
    DocumentRoot "path/to/htdocs/project-folder/public/"
</VirtualHost>

In the virtual machine I have change开发者_开发问答d the hosts file so that http://mymachine redirects to my root localhost directory (equivalent to http://localhost:80/).

How do I set up the virtual machine so that http://project-n/ goes to the correct localhost port? And sadly, http://mymachine:82/ doesn't do the job =(


On the virtual computer, in the hosts file I have added

xxx.xxx.xxx.xxx      project-n.dev

where the x's are my host computer's ip address.

In my host computers httpd-vhosts.conf file I changed the *:80 port to localhost:80. I don't know why this works, just that it does.

My httpd-vhosts.conf file now looks like:

<VirtualHost localhost:80>
    DocumentRoot "path/to/htdocs/"
</VirtualHost>

<VirtualHost *:81>
    DocumentRoot path/to/htdocs/project-a/"
</VirtualHost>

<VirtualHost *:82>
    DocumentRoot path/to/htdocs/project-b/public"
</VirtualHost>

Now, in the virtual pc, when I goto 'http://project-n:81/' it will load project-a, and'http://project-n:82' loads project-b/public =D

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号