如何从 http://localhost:8123 中删除端口号以用作 http://localhost? [英] How to remove port number from http://localhost:8123 to use as http://localhost?

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

问题描述

我不得不将我的默认 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.

完成所有这些更改后,我重新启动了 apache 但我仍然无法访问 http://localhost .... 但是 http://localhost: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.AFAIK,如果不更改浏览器的源代码,就无法改变这种行为.

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.

hosts 文件不支持您尝试执行的重定向类型.规则完全失效了.

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

啊,在某些浏览器中可能会更改默认端口.这是 MozillaZine for Firefox 中的一篇文章.

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

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

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