【发布时间】:2020-01-20 16:59:16
【问题描述】:
我想在一台 Ubuntu 服务器上使用不同的软件,并通过不同的域和相同的 (80) 端口访问它们。该软件在本地的不同端口中运行。例如:
Soft1:example.com:80 -> localhost:9000
Soft2: deneme.com:80 -> localhost:6555
我能做什么?谢谢。
【问题讨论】:
标签: ubuntu dns port portforwarding
我想在一台 Ubuntu 服务器上使用不同的软件,并通过不同的域和相同的 (80) 端口访问它们。该软件在本地的不同端口中运行。例如:
Soft1:example.com:80 -> localhost:9000
Soft2: deneme.com:80 -> localhost:6555
我能做什么?谢谢。
【问题讨论】:
标签: ubuntu dns port portforwarding
您可以通过在 Web 服务器上设置虚拟主机/服务器来实现此目的。既然你没有提到任何网络服务器,我将使用 NGINX。
所以继续关注this guide to setup NGINX。对于您的情况,您将在 /etc/nginx/sites-enabled/ 中为您的域 example.com 和 deneme.com 创建两个配置文件,配置如下:
/etc/nginx/sites-enabled/example.com:
server {
listen 80;
listen [::]:80
server_name example.com
location / {
proxy_pass http://localhost:9000/;
}
}
/etc/nginx/sites-enabled/deneme.com:
server {
listen 80;
listen [::]:80
server_name deneme.com
location / {
proxy_pass http://localhost:6555/;
}
}
现在将您的域指向您的服务器 IP,您应该会看到您的应用程序。
【讨论】: