nginx web configuration tool
QQ technical exchange group 1: 1106758598
QQ technical exchange group 2: 560797506
Email: [email protected]
Official website address: https://www.nginxwebui.cn
Professional version address: https://pro.nginxwebui.cn
Gitee: https://gitee.com/cym1102/nginxWebUI
Github: https://github.com/cym1102/nginxWebUI
Video tutorial: https://www.bilibili.com/video/BV18A4y1D7GZ
WeChat donation QR code
nginxWebUI is a graphical management tool for nginx configuration. You can use web pages to quickly configure various functions of nginx, including http protocol forwarding, tcp protocol forwarding, reverse proxy, load balancing, static html server, and automatic SSL certificate application and renewal. , configuration, etc. After configuration, the nginx.conf file can be generated in one go. At the same time, nginx can be controlled to use this file to start and reload, completing the closed-loop graphical control of nginx.
nginxWebUI can also manage multiple nginx server clusters. You can switch to the corresponding server for nginx configuration at any time with one click. You can also synchronize the configuration of a certain server to other servers with one click to facilitate cluster management.
nginx itself has complex functions. nginxWebUI cannot cover all functions of nginx, but it can cover 90% of nginx's daily functional configurations. For nginx configuration items that are not covered by the platform, you can use custom parameter templates to generate unique parameters in the conf file. .
After deploying this project, you no longer need to search for configuration codes online to configure nginx. You no longer need to manually apply for and configure SSL certificates. You only need to add, delete, modify and check in this project to easily configure and start nginx.
This project is based on solon's web system. The database uses sqlite, so there is no need to install any database on the server.
This system applies for certificates through Let's encrypt, and uses the acme.sh script for automated application and renewal. Certificates that enable renewal will be renewed at 2 a.m. every day. Only certificates that are more than 60 days old will be renewed. Only certificates issued under Linux are supported. .
When adding support for tcp/ip forwarding configuration, some lower versions of nginx may need to be recompiled, and the stream module can be used by adding the –with-stream parameter to specify the installation. However, under Ubuntu 18.04, nginx in the official software library already has the stream module. , no need to recompile. If the tcp forwarding item is configured in this system, the configuration item of ngx_stream_module.so will be automatically introduced. If it is not enabled, it will not be introduced to maximize the optimization of the ngnix configuration file.
Professional version address: https://pro.nginxwebui.cn
Function | Professional version | Open source version |
---|---|---|
Basic parameter configuration | √ | √ |
http parameter configuration | √ | √ |
Reverse proxy configuration | √ | √ |
Stream parameter configuration | √ | √ |
Load balancing configuration | √ | √ |
Parameter template | √ | √ |
Static web page upload | √ | √ |
Password file management | √ | √ |
Blacklist IP | √ | √ |
Certificate application | √ | √ |
API interface documentation | √ | √ |
Remote management | √ | √ |
Unified management of nodes and groups | √ | × |
Unified synchronization of node configuration files | √ | × |
Node information data collection | √ | × |
Node status statistics | √ | × |
Cache configuration | √ | × |
nginx log collection | √ | × |
nginx log viewing | √ | × |
nginx log statistics | √ | × |
nginx traffic statistics | √ | × |
Taking the Ubuntu operating system as an example,
Note: This project requires system commands to be run under the root user, which is extremely easy to be exploited by hackers. Please be sure to change the password to a complex one.
1. Install java environment and nginx
Ubuntu:
apt update
apt install openjdk-11-jdk
apt install nginx
Centos:
yum install java-11-openjdk
yum install nginx
Windows:
下载JDK安装包 https://www.oracle.com/java/technologies/downloads/
下载nginx http://nginx.org/en/download.html
配置JAVA环境变量
JAVA_HOME : JDK安装目录
Path : JDK安装目录bin
重启电脑
2. Download the latest release package jar
Linux: mkdir /home/nginxWebUI/
wget -O /home/nginxWebUI/nginxWebUI.jar https://gitee.com/cym1102/nginxWebUI/releases/download/4.2.5/nginxWebUI-4.2.5.jar
Windows: 直接使用浏览器下载 https://gitee.com/cym1102/nginxWebUI/releases/download/4.2.5/nginxWebUI-4.2.5.jar 到 D:/home/nginxWebUI/nginxWebUI.jar
If there is a new version, you only need to modify the version in the path.
3. Start the program
Linux: nohup java -jar -Dfile.encoding=UTF-8 /home/nginxWebUI/nginxWebUI.jar --server.port=8080 --project.home=/home/nginxWebUI/ > /dev/null &
Windows: java -jar -Dfile.encoding=UTF-8 D:/home/nginxWebUI/nginxWebUI.jar --server.port=8080 --project.home=D:/home/nginxWebUI/
Parameter description (all optional)
--server.port occupies the port, starts with port 8080 by default
--project.home project configuration file directory, which stores database files, certificate files, logs, etc., the default is /home/nginxWebUI/
--spring.database.type=mysql Use other databases, leave it blank to use the local sqlite database, optional mysql
--spring.datasource.url=jdbc:mysql://ip:port/nginxwebui database url
--spring.datasource.username=root database user
--spring.datasource.password=pass database password
Note that Linux commands add an ampersand at the end to indicate that the project is running in the background.
This project produced a docker image that supports the x86_64/arm64/arm v7 platform, including nginx and nginxWebUI, and integrates the management and operation of nginx.
1. Install docker container environment
Ubuntu:
apt install docker.io
Centos:
yum install docker
2. Pull the image:
docker pull cym1102/nginxwebui:latest
或者
docker pull registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest
3. Start the container:
docker run -itd
-v /home/nginxWebUI:/home/nginxWebUI
-e BOOT_OPTIONS="--server.port=8080"
--net=host
--restart=always
cym1102/nginxwebui:latest
或者
docker run -itd
-v /home/nginxWebUI:/home/nginxWebUI
-e BOOT_OPTIONS="--server.port=8080"
--net=host
--restart=always
registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest
Notice:
Please use the --net=host parameter when starting the container to directly map the local port. Because internal nginx may use any port, all ports of the local machine must be mapped.
The container needs to map the path /home/nginxWebUI:/home/nginxWebUI. All data files of the project are stored in this path, including databases, nginx configuration files, logs, certificates, etc. When upgrading the image, this directory can ensure that the project data is not lost. Please note Backup.
The -e BOOT_OPTIONS parameter can fill in the java startup parameters, and you can use this parameter to modify the port number.
--server.port occupies the port. If not filled in, it will start on port 8080 by default.
Another: The configuration file when using docker-compose is as follows
version: "3.2"
services:
nginxWebUi-server:
image: cym1102/nginxwebui:latest
volumes:
- type: bind
source: "/home/nginxWebUI"
target: "/home/nginxWebUI"
environment:
BOOT_OPTIONS: "--server.port=8080"
network_mode: "host"
restart: always
或者
version: "3.2"
services:
nginxWebUi-server:
image: registry.cn-hangzhou.aliyuncs.com/cym19871102/nginxwebui:latest
volumes:
- type: bind
source: "/home/nginxWebUI"
target: "/home/nginxWebUI"
environment:
BOOT_OPTIONS: "--server.port=8080"
network_mode: "host"
restart: always
Use maven to compile and package
mvn clean package
Build an image using docker
docker build -t nginxwebui:latest .
vim /etc/systemd/system/nginxwebui.service
[Unit]
Description=NginxWebUI
After=syslog.target
After=network.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/home/nginxWebUI
ExecStart=/usr/bin/java -jar -Dfile.encoding=UTF-8 /home/nginxWebUI/nginxWebUI.jar
Restart=always
[Install]
WantedBy=multi-user.target
execute after
systemctl daemon-reload
systemctl enable nginxwebui.service
systemctl start nginxwebui.service
Open http://xxx.xxx.xxx.xxx:8080 to enter the homepage
Login page, when you open it for the first time, you will be asked to initialize the administrator account.
After entering the system, you can add and modify the administrator account in the administrator management.
In the http parameter configuration, you can configure the http project of nginx for http forwarding. Several common configurations are given by default. Other required configurations can be added, deleted, modified and checked freely. You can check to enable log tracking to generate log files.
The stream project parameters of nginx can be configured in the TCP parameter configuration, but in most cases it is not necessary.
In the reverse proxy, you can configure nginx's reverse proxy, that is, the server function. You can enable the ssl function, upload pem files and key files directly from the web page, or use the certificate applied in the system to directly enable the http to https function. , you can also enable the http2 protocol
In load balancing, you can configure the load balancing function of nginx, which is the upstream function. In reverse proxy management, you can choose the proxy target to be the configured load balancing.
In html static file upload, you can directly upload the html compressed package to the specified path. After uploading, it can be used directly in the reverse proxy, eliminating the need to upload html files in Linux.
Certificates can be added in the certificate management, and issued and renewed. After the scheduled renewal is turned on, the system will automatically renew the certificate that is about to expire. Note: The certificate is issued using the dns mode of acme.sh, which needs to cooperate with Alibaba Cloud's aliKey and aliSecret to use. Please apply for aliKey and aliSecret first
Backup file management, here you can see the backup historical version of nginx.cnf. When an error occurs in nginx, you can choose to roll back to a certain historical version.
The conf file is finally generated, and further manual modifications can be made here. After confirming that the modifications are correct, the local conf file can be overwritten, verified and restarted. You can choose to generate a single nginx.conf file or separate each configuration file in conf according to the domain name. .d under
Remote server management, if there are multiple nginx servers, you can deploy nginxWebUI on all of them, then log in to one of them, add the IP and username and password of other servers in remote management, and you can manage all nginx servers on one machine. .
Provides one-click synchronization function, which can synchronize the data configuration and certificate files of a certain server to other servers
This system provides http interface calling. Open http://xxx.xxx.xxx.xxx:8080/doc.html to view the smart-doc interface page.
The interface call needs to add the token in the http request header. To obtain the token, you need to first open the user's interface calling permission in the administrator management, and then call the token interface through the user name and password to obtain the token.
If you forget your login password or do not save the two-step verification QR code, you can follow the tutorial below to reset your password and turn off two-step verification.
1.jar installation method, execute command
java -jar /home/nginxWebUI/nginxWebUI.jar --project.home=/home/nginxWebUI/ --project.findPass=true
--project.home is the directory where the project file is located, or the mapping directory when using a docker container
--project.findPass is whether to print username and password
After successful operation, you can reset and print out all usernames and passwords and turn off two-step verification.
2. Docker installation method, first execute the command to enter the docker container, where {ID} is the id of the container
docker exec -it {ID} /bin/sh
Execute the command again
java -jar /home/nginxWebUI.jar --project.findPass=true
After successful operation, you can reset and print out all usernames and passwords and turn off two-step verification.