Ubuntu 如何将域重定向到同一服务器上的不同端口?

Ubuntu 如何将域重定向到同一服务器上的不同端口?,ubuntu,dns,port,portforwarding,Ubuntu,Dns,Port,Portforwarding,我想在一台Ubuntu服务器上使用不同的软件,并用不同的域和相同的(80)端口访问它们。这些软件在本地的不同端口工作。例如: Soft1:example.com:80->localhost:9000 Soft2:deneme.com:80->localhost:6555 我能做什么?谢谢。您可以通过在web服务器上设置虚拟主机/服务器来实现这一点。既然你没有提到任何网络服务器,我就选择NGINX 因此,请继续并遵循。对于您的情况,您将在/etc/nginx/sites enabled/中为您的域

我想在一台Ubuntu服务器上使用不同的软件,并用不同的域和相同的(80)端口访问它们。这些软件在本地的不同端口工作。例如:

Soft1:example.com:80->localhost:9000

Soft2:deneme.com:80->localhost:6555


我能做什么?谢谢。

您可以通过在web服务器上设置虚拟主机/服务器来实现这一点。既然你没有提到任何网络服务器,我就选择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/;
    }
}
server {
    listen       80;
    listen       [::]:80
    server_name  deneme.com

    location / {
           proxy_pass http://localhost:6555/;
    }
}
/etc/nginx/sites enabled/deneme.com

server {
    listen       80;
    listen       [::]:80
    server_name  example.com

    location / {
           proxy_pass http://localhost:9000/;
    }
}
server {
    listen       80;
    listen       [::]:80
    server_name  deneme.com

    location / {
           proxy_pass http://localhost:6555/;
    }
}

现在将您的域指向您的服务器IP,您应该可以看到您的应用程序。

很高兴提供帮助:)