7

My Nginx reverse proxy works on the same machine as the webserver(apache) as follows

server {  server_name site.net;
    location / {
        proxy_pass http://localhost:82;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
}

}

Now instead of using TCP connections to the backend apache, how can I tune it to use unix sockets?

Edit:
Can someone help with the full flow, instructing apache to listen on unix sockets too

Quintin Par
  • 4,493

2 Answers2

11

While you most likely could set Nginx to proxy redirect to a socket using unix:/path/to/socket syntax, Apache Listen directive only accepts IPv4 or IPv6, so as far as I know you can't get Apache to listen on an unix socket.

c2h5oh
  • 1,499
6

You need to define an upstream like this:

upstream upstream_name {
        server unix:/path/to/socket fail_timeout=0;
}

And then set proxy_pass to reference that upstream by name, i.e.,

proxy_pass http://upstream_name
Clint Miller
  • 1,141