D
D
Dan Skatov2011-03-07 14:07:14
Domain Name System
Dan Skatov, 2011-03-07 14:07:14

Services routing (port + machine in LAN) via a third-level domain

Let be:

  • One 192.168.1.1:5050service is spinning, I want to access it byapp1.site.ru
  • The 192.168.1.2:4040second service is spinning, respectively - I want toapp2.site.ru
  • The 192.168.1.3:3030third service is spinning, I want to go thereapp3.site.ru

Access by appN.site.ru, N=1,2,3 - needed without specifying a port, i.e. at 80.

Yes, while the website is not available from this server at all www.site.ru. site.ru+ mail by alias mail.site.ruand other DNS records.

It is clear that I will scout ports and machines on the server.

But in general, how to solve it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ADOLF88HITLER, 2011-03-07
@ADOLF88HITLER

If you have nginx installed on the server, then I can offer the following solution:
Let's say:
site.ru server ip: 1.1.1.1;
ip of the router that binds NAT and Network: 2.2.2.2.
In the router, port forwarding:
5050 to 192.168.1.1:5050;
4040 to 192.168.1.2:4040;
3030 to 192.168.1.3:3030.
Etc.
In nginx.conf write: And accordingly to other domains. According to this scheme, the server from app1.site.ru will direct to 2.2.2.2:5050, the router will redirect to 192.168.1.1:5050 via Port Forwarding. Everything is about here, and there is still room for improvement, but I think the meaning is clear. This is all provided that I understand you correctly :)
server {
listen 1.1.1.1:80;
server_name: app1.site.ru;
location / {
proxy_pass http: //2.2.2.2:5050; #убрать пробел после http:, а то парсер съел.
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question