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
- nginx
reverse ssl proxy with multiple subdomains
- Using
Nginx as Webserver
- Nginx
to apache reverse proxy, instruct use of unix sockets
- Difference between socket- and
port-based connection to outer NGINX?
- 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;
*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;
}