Welcome! Log In Create A New Profile

Advanced

Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Posted by PackElend 
I am trying to configure nginx as a reverse proxy for multiple servers on my LAN. They should go out on my WAN with different subdomains.
Unlike the approach described in Use Nginx as Reverse Proxy for multiple servers I want to use UNIX socket for the interprocess communication on my server.

Based on

- the above post
https://serverfault.com/questions/706694/use-nginx-as-reverse-proxy-for-multiple-servers
- nginx reverse ssl proxy with multiple subdomains
https://serverfault.com/questions/538803/nginx-reverse-ssl-proxy-with-multiple-subdomains
- Using Nginx as Webserver
https://serverfault.com/questions/433053/nginx-to-apache-reverse-proxy-instruct-use-of-unix-sockets
- Nginx to apache reverse proxy, instruct use of unix sockets
https://serverfault.com/questions/433053/nginx-to-apache-reverse-proxy-instruct-use-of-unix-sockets
- Difference between socket- and port-based connection to outer NGINX?
https://meta.discourse.org/t/difference-between-socket-and-port-based-connection-to-outer-nginx/60071
- keeping in mind the solution given in How do I configure Nginx proxy_pass Node.js HTTP server via UNIX socket?
https://serverfault.com/questions/316157/how-do-i-configure-nginx-proxy-pass-node-js-http-server-via-unix-socket

my configuration shall look something like this below, doesn't it? In order to keep the main file slim, I would like to outsource the location blocks.
I find all on the web more or less but nothing about wow I can reach the servers in within the LAN? Do I need to set up a local DNS server as described in Running DNS locally for home network (https://superuser.com/questions/45789/running-dns-locally-for-home-network)?

main proxy file

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
#include letsencrypt.conf;
server_app1 app1subdomain.domain.eu;
*read app1location.file*
}

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
#include letsencrypt.conf;
server_app2 app2subdomain.domain.eu;
*read app2location.file*
}

location files for proxied web servers:

location / {
proxy_pass http://unix:/home/app1/app1.com.unix_socket;
proxy_set_header X-Real-IP $remote_addr; #Authorization
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}

-

location / {
proxy_pass http://unix:/home/app2/app2.com.unix_socket;
proxy_set_header X-Real-IP $remote_addr; #Authorization
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready