RELATED TAGS linux, routing, multiple services, server
QUESTIONS
How can I run multiple servers on the same port?
What do I need to combine multiple services?
How do I keep a process running when ssh closes?
LINKS Nginx website
There are often situations, where you have multiple services that you want to run on one server.
To avoid manual reconfiguration of port management or simply hiding the source Nginx can be used
to take requests and rewrite them. The following configuration can be used to send multiple
different DNS to different ports as root.
Login
Login on the remote server via sshyou@local:$ssh root@{server-adress}
Install Nginx
If not already installed, install Nginxroot@server:$sudo aptinstallnginx
Test Nginx root@server:$nginx-v
Nginx should output the installed version.
Create File
To add a new routing, add a file in /etc/nginx/sites-available with the name my-service
Change dir:
root@server:$cd/etc/nginx/sites-available
Open in Nano:
root@server:$nanomy-service
Write routing:
server
{
listen 443 ssl;
server_name my-service.com;
location /
{
proxy_pass http://127.0.0.1:8080;
}
}
Save file and close Nano.
Create Symlink To Enabled Sites
To activate the routing, create a symlink of the file from sites-available in nginx's sites-enabled directory
root@server:$ln-s/etc/nginx/sites-available/my-service/etc/nginx/sites-enabled
Run Nginx root@server:$systemctlstartnginx
Test Nginx Status root@server:$systemctlstatusnginx
For any additional routing just create another file.
APP | VERSION Linux/Ubuntu 22
RELATED TAGS linux, routing, multiple services, server
QUESTIONS
How can I run multiple servers on the same port?
What do I need to combine multiple services?
How do I keep a process running when ssh closes?