开发者

XAMPP (WIN7) port change and vhosts

I've decided to change the ports for Apache to clear up some conflicts with other applications, and maybe even give IIS a shot in the future. I've run into the problem described below.

The basic context:

WIN 7 x64
XAMPP 1.7.4 (Apache 2.2.17, MySQL 5.5.8, PHP 5.3.5)

So I've changed the default Apache port from 80 to 8080, by changing this in the httpd.conf:

Listen 8080 (was Listen 80)
ServerName localhost:8080 (was ServerName localhost)

In my vhosts file I have:

NameVirtualHost 127.0.0.1:8080

And several virtual hosts defined like this:

<VirtualHost 127.0.0.1:8080>
    DocumentRoot "somepath"
    ServerName servername
    <directory "somepath">
   开发者_StackOverflow中文版     usual stuff here
    </directory> 
</VirtualHost>

When I try to access the virtual host using the servername defined above it does not work without explicitly specifying the port:

servername:8080

It would also seem that the port defined in the vhosts file does not make any difference, whatever I tried (80, 8080, nothing), it allways requires the port to be given with the server name.

phpinfo() says:

SERVER_PORT: 8080 

Apache error logs do not show any errors.

I guess I'm wondering if this is normal behaviour, or there is something I overlooked.


The 80 port is default for browsers so that's why you don't need to access servername:80. In your case it's normal to acces server like this : servername:8080


If your want to access localhost without specify the port number in the URL
http://localhost instead of http://localhost:8080.

  • Open Xampp Control Panel
  • Go to ConfigService and Port SettingsApache
  • Replace the Main Port value ​​with 8080.
  • Save Service settings
  • Save Configuration of Control Panel
  • Restart the Apache Server

    XAMPP (WIN7) port change and vhosts

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜