Answer the question
In order to leave comments, you need to log in
Services routing (port + machine in LAN) via a third-level domain
Let be:
192.168.1.1:5050
service is spinning, I want to access it byapp1.site.ru
192.168.1.2:4040
second service is spinning, respectively - I want toapp2.site.ru
192.168.1.3:3030
third service is spinning, I want to go thereapp3.site.ru
appN.site.ru
, N=1,2,3 - needed without specifying a port, i.e. at 80. www.site.ru
. site.ru
+ mail by alias mail.site.ru
and other DNS records. Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question