Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将在特定端口号上运行的服务映射到 Ubuntu 8.10 上的别名?
例如,我有一个可以像这样访问的网络服务:
http://localhost:3000/
但我想这样访问:
http://myservice/
我只想从同一台机器访问该服务。
我正在运行 Ubuntu 8.10,起初我认为我可以修改 /etc/hosts 文件,但现在我明白我不能包含端口号。到目前为止,我还查看了 /etc/services 文件,但没有任何运气......
“http”的默认端口是 80,因此您需要 root 权限才能执行此操作。您可以采取多种路线:
ssh -l root -L 3000:localhost:80 localhost