0

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

  1. the above post
  2. nginx reverse ssl proxy with multiple subdomains
  3. Using Nginx as Webserver
  4. Nginx to apache reverse proxy, instruct use of unix sockets
  5. Difference between socket- and port-based connection to outer NGINX?
  6. keeping in mind the solution given in 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?

main proxy file

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

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

app1location.conf (location file for proxied web server)

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;
           }

app2location.conf (location file for proxied web server)

   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;
               }
Stefan
  • 131
  • 5

0 Answers0