如何从http除去端口号://本地主机:8123为使用http://本地主机? [英] How to remove port number from http://localhost:8123 to use as http://localhost?

查看:3099
本文介绍了如何从http除去端口号://本地主机:8123为使用http://本地主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不改变我的默认的Apache端口号80到8123(只是随机数)

I had to change my default apache port number 80 to 8123 (just random number)

我改变了下面的文件。

的httpd.conf

Listen 8123
ServerName localhost:8123

的httpd-vhosts.conf

NameVirtualHost *:8123
<VirtualHost *:8123>
  ServerName localhost
  DocumentRoot "C:/xampp/htdocs"
  DirectoryIndex index.php
</VirtualHost>

Windows主机文件

127.0.0.1:8123     localhost
::1:8123           localhost

我使用Windows 7。

I am using Windows 7.

完成所有这些更改后,我重新启动阿帕奇但我仍然无法访问的http://本地主机 ....但 HTTP: //本地主机:8123 工作正常...谁能帮我找到我在做什么错在这里?谢谢

After making all these changes, I restarted apache but I am still unable to access http://localhost .... however http://localhost:8123 works fine ... can someone help me find what I am doing wrong here? thanks

推荐答案

要做到这一点,唯一的办法就是改回 80 ,或者安装在端口侦听器80(如代理)的所有流量重定向到端口8123。

The only way to do this is to change back to 80, or to install a listener on port 80 (like a proxy) that redirects all your traffic to port 8123.

当你没有一个端口输入服务器名称,端口80是默认假设。据我所知,有没有办法改变这种行为不改变浏览器的源代码code。

When you enter a server name without a port, port 80 is assumed by default. AFAIK, there is no way to change this behaviour without changing your browser's source code.

主机文件不支持那种你正在尝试做的重定向。规则简单地失败。

The hosts file does not support the kind of redirection you are trying to do. The rules simply fail.

编辑:啊,有可能更改默认端口在某些浏览器。 这里的在MozillaZine的针对Firefox的文章。

ah, it might be possible to change the default port in some browsers. Here's an article in MozillaZine for Firefox.

这篇关于如何从http除去端口号://本地主机:8123为使用http://本地主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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