如何将在特定端口号上运行的服务映射到 Ubuntu 上的别名?
如何将在特定端口号上运行的服务映射到 Ubuntu 8.10 上的别名?
例如,我有一个网络服务,我可以这样访问:
http://localhost:3000/
但我想这样访问:
http://myservice/
我只想从同一台机器访问该服务。
我运行的是 Ubuntu 8.10,一开始我以为我可以修改 /etc/hosts 文件,但我现在明白我不能包含端口号。 我还查看了 /etc/services 文件,到目前为止没有任何运气......
How I can map a service running on a specific port number to an alias on Ubuntu 8.10?
For example, I have a webservice which I can access like this:
http://localhost:3000/
But I want to access like this:
http://myservice/
I only want to access the service from the same machine.
I am running Ubuntu 8.10 and I thought at first I could modify the /etc/hosts file but I now understand I cannot include port numbers. I also looked at /etc/services file without any luck so far...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“http”的默认端口是 80,因此您需要 root 权限才能执行此操作。 您可以采取多种途径:
ssh -l root -L 3000:localhost:80 localhost
The default port for "http" is 80, so you need root privileges to do this. There are several routes you can take:
ssh -l root -L 3000:localhost:80 localhost