如何从http除去端口号://本地主机:8123为使用http://本地主机?

编程入门 行业动态 更新时间:2024-10-22 09:30:16
本文介绍了如何从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 localhost .... however 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://本地主机?

本文发布于:2023-11-16 11:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1603791.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主机   端口号   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!