Nginx Proxy Manager is a popular open-source tool that is used to manage multiple Nginx proxy servers from a single web interface. In this article, we will guide you through the process of installing Nginx Proxy Manager on a fresh installation of Ubuntu 18.04.
Before we begin, make sure that you have a fresh installation of Ubuntu 18.04 and that Nginx is installed on your system. You will also need to be logged in as a user with sudo
privileges.
Install the required dependencies
The first step is to install the required dependencies for Nginx Proxy Manager. To do this, run the following commands in the terminal:
sudo apt update
sudo apt install python3 python3-pip python3-dev libpq-dev postgresql postgresql-contrib
This will install the necessary dependencies for Nginx Proxy Manager, including Python 3, pip, PostgreSQL, and the required development libraries.
Create a new PostgreSQL user and database
Next, we need to create a new PostgreSQL user and database for Nginx Proxy Manager. To do this, log in to the PostgreSQL shell using the following command:
sudo -u postgres psql
In the PostgreSQL shell, run the following commands to create a new user and database:
CREATE USER nginxproxymanager WITH PASSWORD 'password';
CREATE DATABASE nginxproxymanager;
GRANT ALL PRIVILEGES ON DATABASE nginxproxymanager TO nginxproxymanager;
Make sure to replace “password” with the actual password that you want to use for the PostgreSQL user.
Install Nginx Proxy Manager
After creating the PostgreSQL user and database, we can install Nginx Proxy Manager using pip. To do this, run the following command in the terminal:
sudo pip3 install nginx-proxy-manager
This will install the latest version of Nginx Proxy Manager using pip.
Create the configuration file
After installing Nginx Proxy Manager, we need to create a configuration file that specifies the settings for the application. To create the file, run the following command in the terminal:
npm_config_file=/etc/npm/npm.conf
In the file, add the following configuration:
[DEFAULT]
# Database settings
sqlalchemy.url = postgresql://nginxproxymanager:password@localhost/nginxproxymanager
# Web server settings
flask.host = 127.0.0.1
flask.port = 8080
Make sure to replace "password"
with the actual password that you set for the PostgreSQL user in the previous step. Save the file and exit the editor.
Initialize the database
After creating the configuration file, we need to initialize the database for Nginx Proxy Manager. To do this, run the following command in the terminal:
npm-initdb
This will create the necessary tables and initialize the database for Nginx Proxy Manager.
Start Nginx Proxy Manager
After initializing the database, we can start the Nginx Proxy Manager application using the following command:
npm-run
This will start the Nginx Proxy Manager web interface on the default port 8080.