Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was 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

Description

@casswarry0

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions