Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Using unix socket and nginx as reverse proxy to access web server #42

Open
casswarry0 opened this issue Apr 6, 2020 · 0 comments
Open

Comments

@casswarry0
Copy link

To make mailman open a unix socket for the web server I had to change the file:
/opt/mailman/build/main.js

where it was:
const server = app.listen(port, process.env.MAILMAN_HOST || "0.0.0.0", () => console.log("Mailman is running on http://%s:%d%s in %s mode", server.address().address, server.address().port, base, "production"));

I made:
var server;
if (process.env.MAILMAN_SOCKET) {
var fs = require('fs');
server = app.listen(process.env.MAILMAN_SOCKET, () => console.log("Mailman is running on socket %s in %s mode", process.env.MAILMAN_SOCKET, "production"), () => fs.chmodSync(process.env.MAILMAN_SOCKET, '666'));
} else {
server = app.listen(port, process.env.MAILMAN_HOST || "0.0.0.0", () => console.log("Mailman is running on http://%s:%d%s in %s mode", server.address().address, server.address().port, base, "production"));
}

In /opt/mailman/.env define:
MAILMAN_SOCKET=/path/to/socket

In nginx the configuration include:
proxy_pass http://unix:/path/to/socket:$uri$is_args$args;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant