Note that the nginx directory mapping needs to be modified and ensure that the directory is empty.
version: '3.3'
services:
nginx-ui:
image: uozi/nginx-ui:latest
container_name: nginx-ui
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
- /usr/docker/nginx/nginx:/etc/nginx
- /usr/docker/nginx/nginx-ui:/etc/nginx-ui
ports:
- 80:80
- 443:443
This code is a Docker Compose file used to install and configure an Nginx management interface called "nginx-ui". To install it, follow these steps:
-
First, make sure you have Docker and Docker Compose installed. You can find installation guides for your operating system on the official website.
-
Create the directory
/usr/docker/nginx
:
Open a terminal or command line interface and enter the following command:sudo mkdir -p /usr/docker/nginx
This will create a new directory under the path
/usr/docker/nginx
. Note that since this is creating a directory under the system's/usr
directory, you may need to execute this command with administrative privileges (sudo). -
Create and edit a new file:
Enter the following command to create and open a new file:sudo nano /usr/docker/nginx/docker-compose.yml
This will create a file named
docker-compose.yml
using the nano text editor and open it for editing. -
Copy and paste the code:
Copy and paste your code into thedocker-compose.yml
file. -
Save the file:
In the nano editor, pressCtrl + O
(uppercase letter O) to save the file. Then pressEnter
to confirm the save. -
Exit the editor:
PressCtrl + X
to exit the nano editor.
Now, you should have successfully created the directory /usr/docker/nginx
and copied the code into a file named docker-compose.yml
. Note that when copying and pasting the code, make sure the formatting is correct and fits your needs.
-
Run the following command to start the Nginx management interface container:
docker-compose up -d
This command will download the necessary image (if not already downloaded) and then create and start a container named "nginx-ui".
The installation process may take some time depending on your network connection and system performance. When everything is successfully completed, you should be able to access the Nginx management interface through a web browser.
- For local installation, open a browser and access
http://localhost
. - For remote server installation, use the IP address or domain name of the server to access
http://server-IP-address
.
This will display the Nginx management interface where you can configure and manage Nginx. Just fill in the email+account+password, and there is no need to modify the database name.