Configure Basic Authentication for MLflow

You can use the steps below to configure NGINX as a reverse proxy that protects access to MLflow running on a node with basic authentication (username and password).

Access http://<your-server> and enter the username and password to reach the MLflow UI running on a node.

Steps to install

  1. Install Nginx (if not already installed)

On Ubuntu/Debian:

Bash
Copy

On RHEL/CentOS:

Bash
Copy
  1. Install apache2-utils to create .htpasswd.
Bash
Copy
  1. Create the password file (.htpasswd).
Bash
Copy

You’ll be prompted to enter a password. Replace mlflowuser with your preferred username.

  1. Configure Nginx reverse proxy with basic authentication.

Edit or create the file:

Bash
Copy

Paste this configuration:

Bash
Copy

Optional: Replace mlflow.local with your domain or server IP, or use _ to match all incoming requests.

  1. Test and reload Nginx
Bash
Copy
  1. (Optional) Add a hosts entry for mlflow.local.

If you're using a custom domain name like mlflow.local, add an entry on your local machine to map it to the MLflow server.

Open the hosts file:

Bash
Copy

Add the following line (replace with your server IP if different):

Bash
Copy

Save and close the file.

This is only needed if you're using a fake domain instead of the IP.

  1. Generate a self-signed SSL certificate
Bash
Copy
  1. Update your NGINX config to use SSL.
Bash
Copy
  1. Open port 443 in the firewall.
Bash
Copy

Optional: Test Access Using curl

Run the following command to test basic authentication with your MLflow server.

Bash
Copy

Username - mlflowuser

Password - admin

This verifies that the NGINX reverse proxy and basic authentication are working as expected.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated