更改浏览器/系统默认的本地主机端口(80)自定义 [英] Change browser/system default localhost port (80) to custom

查看:1254
本文介绍了更改浏览器/系统默认的本地主机端口(80)自定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用XAMPP或WAMP我得到了以下问题:

<一个href=\"http://stackoverflow.com/questions/20558410/xampp-port-80-in-use-by-unable-to-open-process-with-pid-4-12\">XAMPP - 80端口在使用由&QUOT;无法打开流程&QUOT;具有PID 4! 12

和它`很容易通过改变阿帕奇的.ini文件来解决它,并告诉他使用8080端口(比如)...

但后来我总是需要在URL中指定自定义端口:

HTTP://localhost.myapp:8080

虽然没有修改默认的Apache本地主机端口:当他是原来的80,我只是把:

HTTP://localhost.myapp <​​/A>

所以我想80端口是默认不只是为Apache,但别的东西。如果有其他的方式来配置浏览器/ Windows系统/不管,告诉他的默认参数,默认本地主机端口现在是8080(举例来说),所以我仍然可以使用较短的网址版本...

谢谢,


解决方案

根据 RFC2616 ,针对HTTP的默认端口是80,所以浏览器被设计成跨preT的请求没有定义的端口为80端口的请求据我所知,是没有办法来覆盖默认的(没有一些浏览器的code认真修改),无论是对单个主机(例如localhost)或所有主机。

底线:如果你想使用80以外的端口,该端口必须在请求中定义,如'本地主机:8080 /资产

这是说,这个命令应该显示哪些程序在大多数Linux发行版上的80端口侦听(这样你就可以弄清是怎么保持的Apache从能够使用80端口):

 须藤netstat的-apn | grep的:80

例如,我的小测试服务器上,我得到这样的输出:

  TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1491 / Apache2的

这告诉我它正在使用的Apache(PID 1491)。

用netstat是一个伟大的工具,这里是一个文章,让如何使用这个工具了一些额外的例子。

When I using XAMPP or WAMP I getting the following issue:

XAMPP - Port 80 in use by "Unable to open process" with PID 4! 12

And it`s easy to solve it by changing the .ini file of Apache and tell him to use port 8080 (for example)...

But then I need always to specify in the URL the custom port:

http://localhost.myapp:8080

While without modifying the default Apache localhost port: When he is the original 80, I could just put:

http://localhost.myapp

So I guess port 80 is default not just for Apache but for something else. My question if there is other way to config default parameter of browser/windows-system/whatever, to tell him that the default localhost port is now 8080 (for example), so I can still use the shorter URL version...

Thanks,

解决方案

According to RFC2616, the default port for HTTP is 80, so browsers are designed to interpret a request without a defined port as a request to port 80. As far as I'm aware, there is no way to override this default (without some serious modification of the browser's code), either for a single host (such as localhost) or for all hosts.

Bottom line: If you want to use a port other than 80, that port must be defined in the request, as in 'localhost:8080/asset'.

That said, this command should show you which program is listening on port 80 in most linux distros (so you can figure out what's keeping Apache from being able to use port 80):

 sudo netstat -apn | grep :80

For instance, on my little test server, I get this output:

tcp        0      0 0.0.0.0:80            0.0.0.0:*             LISTEN      1491/apache2

Which tells me it's being used by Apache (PID 1491).

Netstat is a great tool, here's an article that gives a few additional examples of how to use this tool.

这篇关于更改浏览器/系统默认的本地主机端口(80)自定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆