Nginx UI allows you to access and modify the nginx configurations files without cli.

Overview

nginx ui

Docker Image CI

Image of Nginx UI

Table of Contents

Introduction

We use nginx in our company lab environment. It often happens that my colleagues have developed an application that is now deployed in our Stage or Prod environment. To make this application accessible nginx has to be adapted. Most of the time my colleagues don't have the permission to access the server and change the configuration files and since I don't feel like doing this for everyone anymore I thought a UI could help us all. If you feel the same way I wish you a lot of fun with the application and I am looking forward to your feedback, change requests or even a star.

Setup

Containerization is now state of the art and therefore the application is delivered in a container.

Example

  • -d run as deamon in background
  • --restart=always restart on crash or server reboot
  • --name nginxui give the container a name
  • -v /etc/nginx:/etc/nginx map the hosts nginx directory into the container
  • -p 8080:8080 map host port 8080 to docker container port 8080
docker run -d --restart=always --name nginxui -v /etc/nginx:/etc/nginx -p 8080:8080 schenkd/nginx-ui:latest

Docker

Repository @ DockerHub

Docker Compose excerpt

# Docker Compose excerpt
services:
  nginx-ui:
    image: schenkd/nginx-ui:latest
    ports:
      - 8080:8080
    volumes:
      - nginx:/etc/nginx

UI

Image of Nginx UI

With the menu item Main Config the Nginx specific configuration files can be extracted and updated. These are dynamically read from the Nginx directory. If a file has been added manually, it is immediately integrated into the Nginx UI Main Config menu item.

Image of Nginx UI

Adding a domain opens an exclusive editing window for the configuration file. This can be applied, deleted and enabled/disabled.

Authentication

BasicAuth with nginx

In general, this app does not come with authentication. However, it is easy to setup basic auth to restrict unwanted access. Here is how this can be done when using nginx.

Configure the auth file

  1. Verify that apache2-utils (Debian, Ubuntu) or httpd-tools (RHEL/CentOS/Oracle Linux) is installed
  2. Run the htpasswd utility to create a new user and set a passwort.
    • Make sure, that the directory exists
    • Remove the -c flag, if you have created a user before, since it creates the inital user/passwort file
    • sudo htpasswd -c /etc/apache2/.htpasswd user1

Configure nginx

The following example adds basic auth to our nginxui app running in a docker container with a mapped port 8080. In this case, it will be accessible via nginx.mydomain.com

server {
    server_name nginx.mydomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080/;
    }

    auth_basic "nginxui secured";
    auth_basic_user_file /etc/apache2/.htpasswd;

    # [...] ommited ssl configuration
}
  1. Add above nginx conf to your /etc/nginx/my.conf file
  2. Run nginx -t to make sure, that your config is valid
  3. Run systemctl restart nginx (or equivalent) to restart your nginx and apply the new settings
  4. Your nginx ui is now accessible at nginx.mydomain.com and will correctly prompt for basic auth
Comments
  • Fixed app/templates/new_domain.j2

    Fixed app/templates/new_domain.j2

    Fix invalid Nginx config template and change access_log to /tmp/{{ name }}.access.log to avoid file permission.

    from

    {
        listen          80;
        server_name     {{ name }},
        access_log      logs/{{ name }}.access.log main;
    
        location / {
            proxy_pass      http://127.0.0.1:8080;
        }
    
    }
    

    to

    server {
        listen          80;
        server_name     {{ name }};
        access_log      /tmp/{{ name }}.access.log main;
    
        location / {
            proxy_pass  http://127.0.0.1:8080;
        }
    }
    
    
    opened by narate 4
  • Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    ❯ docker run -d --restart=always --name nginxui -p 3333:8080 -v /etc/nginx:/nginx schenkd/nginx-ui:latest

    ❯ docker logs nginxui *** Starting uWSGI 2.0.18 (64bit) on [Tue Jun 23 01:55:51 2020] *** compiled with version: 9.3.0 on 21 June 2020 09:42:26 os: Linux-5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 nodename: f5f7495cb4e6 machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 8 current working directory: /webapp detected binary path: /usr/local/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** WARNING: you are running uWSGI without its master process manager *** your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI http bound on 0.0.0.0:8080 fd 4 spawned uWSGI http 1 (pid: 6) uwsgi socket 0 bound to TCP address 127.0.0.1:33773 (port auto-assigned) fd 3 uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** Python version: 3.7.7 (default, Jun 3 2020, 19:58:28) [GCC 9.3.0] Python main interpreter initialized at 0x55f7fbfe7ce0 uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 145984 bytes (142 KB) for 8 cores *** Operational MODE: threaded *** WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55f7fbfe7ce0 pid: 1 (default app) uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 1, cores: 8) [2020-06-23 01:56:30,544] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "./app/ui/views.py", line 15, in index config = [f for f in os.listdir(nginx_path) if os.path.isfile(os.path.join(nginx_path, f))] FileNotFoundError: [Errno 2] No such file or directory: '/etc/nginx' [pid: 1|app: 0|req: 1/1] 172.17.0.1 () {48 vars in 914 bytes} [Tue Jun 23 01:56:30 2020] GET / => generated 290 bytes in 3 msecs (HTTP/1.1 500) 2 headers in 99 bytes (1 switches on core 1) [pid: 1|app: 0|req: 2/2] 172.17.0.1 () {46 vars in 832 bytes} [Tue Jun 23 01:56:30 2020] GET /favicon.ico => generated 232 bytes in 0 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 1)

    ❯ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f5f7495cb4e6 schenkd/nginx-ui:latest "uwsgi --http 0.0.0.…" 32 seconds ago Up 30 seconds 0.0.0.0:3333->8080/tcp nginxui

    unable to run on http://localhost:3333/

    Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

    opened by Raju 4
  • /static/themes missing on manual build

    /static/themes missing on manual build

    I'm running on Aarch64 so had to build from source as you only seem to have Arm64 containers.

      nginxui:
        container_name: nginxui
        build: https://github.com/schenkd/nginx-ui.git
        volumes:
          - /opt/nginx:/etc/nginx
        restart: unless-stopped
        networks:
          - internal
    

    However there is no content in the /static/themes folder in the web app, these means the outline-icons aren't loaded.

    bug 
    opened by mattheys 4
  • Configuration if Nginx also running in container

    Configuration if Nginx also running in container

    Can you give an example of the docker startup command or the docker-compose.yml if the nginx instance also running in a docker container. How can we link both containers?

    question 
    opened by JoLander 3
  • No authentication mechanisms

    No authentication mechanisms

    Currently there is no way to secure the web interface. The nginx directory is directly mapped to the Docker container and any person on the same network can access the control panel.

    I suggest either implementing any authentication mechanism like username/password authentication backed up by a database or warning about this in README.md and suggesting to enable basic HTTP authentication at least.

    question 
    opened by maxkreja 3
  • :latest crashes during startup

    :latest crashes during startup

    Im trying to setup nginx-ui, but executing docker run -d --restart=always --name nginxui -p 7777:8080 schenkd/nginx-ui:latest -v /etc/nginx:/nginx results in the container not starting correctly and constantly crashing.

    docker logs nginxui results in the following message, without a real error info:

    *** Starting uWSGI 2.0.18 (64bit) on [Mon Jun 22 08:00:31 2020] *** compiled with version: 9.3.0 on 21 June 2020 09:42:26 os: Linux-5.4.0-33-generic #37-Ubuntu SMP Thu May 21 12:53:59 UTC 2020 nodename: eada146745a8 machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 1 current working directory: /webapp detected binary path: /usr/local/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** *** WARNING: you are running uWSGI without its master process manager *** your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** The -s/--socket option is missing and stdin is not a socket.

    Any idea? Thanks :)

    opened by LucaNerlich 3
  • Getting an error on a fresh install

    Getting an error on a fresh install

    I'm getting following error after executing docker run -d --restart=always --name nginxui -v /etc/nginx:/etc/nginx -p 8080:8080 schenkd/nginx-ui:latest:

    [2020-07-13 13:53:52,503] ERROR in app: Exception on /api/domains [GET]
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
        response = self.full_dispatch_request()
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
        raise value
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
        rv = self.dispatch_request()
      File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "./app/api/endpoints.py", line 60, in get_domains
        for _ in os.listdir(config_path):
    FileNotFoundError: [Errno 2] No such file or directory: '/etc/nginx/conf.d'
    

    I obv do have nginx installed and that dir exists. I also tried changing the permissions but the problem persists. I feel like I'm making a dumb mistake here :P

    opened by bkhanale 2
  • [Suggestion] Implement nginxconfig.io

    [Suggestion] Implement nginxconfig.io

    Hey guys, just thought it would be cool to have a section that would integrate into this application which would expose the DigitalOcean's Nginx config "generator". I'm assuming that the "target audience" might really appreciate that. https://github.com/digitalocean/nginxconfig.io Curious what you guys think!

    duplicate 
    opened by flying-sausages 2
  • Support openresty

    Support openresty

    Can you add support for openresty too ? The only different between openresty and nginx is the name when run the command.

    Reload: nginx: systemctl reload nginx openresty: systemctl reload openresty

    Check config: nginx: nginx -t openresty: openresty -t

    question 
    opened by hong-duc 1
  • Support for arm64?

    Support for arm64?

    WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested.

    Can you somehow add support for arm64?

    opened by HalfdanDK 0
  • Nginx template fix and reloading on domain update, delete or disable

    Nginx template fix and reloading on domain update, delete or disable

    I fixed the template, as there was missing 'server' before the start of the template and comma error line. Also, using default logs path instead of nginx's log dir.

    opened by akay25 0
  • Docker security

    Docker security

    Hi, i have deployed nginx-ui on Docker like documentation but i have a problem: if I try to access to nginx-ui through nginx proxy all is ok (basic auth ask me login) but if i go direct on port 8080 then i can access to nginx-ui bypassing nginx proxy. So, this is a summary: nginx.mysite.com -> asking login (OK!!!) mysite.com:8080 -> i can access to nginx-ui without login.

    Any helps? NGINX config

    server { 
     listen 80;
     server_name nginx.mysite.com; 
     return 301 https://$host$request_uri; 
    } 
    server {
        listen 443 ssl; 
        server_name nginx.mysite.com; 
        ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem; 
        ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; 
        include /etc/letsencrypt/options-ssl-nginx.conf; 
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    
        location / {
            proxy_pass http://127.0.0.1:8080/;
        }
    
        auth_basic "nginxui secured";
        auth_basic_user_file /etc/apache2/.htpasswd;
    }
    
    opened by matteoventuri7 1
  • Is there a binary release available? I need to integrate it with

    Is there a binary release available? I need to integrate it with

    Is there a binary release (without a container) available? I need a binary version so that I can integrate it with my VPS Bootstrapper (a GUI VPS control panel that runs on Windows desktop, Free edition available), and I don't think it's possible with a container...

    To help you understand my question, I'm posting a screen of this GUI tool below, basically I want to let the user click a button to install nginx-ui (with authentication set) so that other users can also edit the nginx configurations through the web.

    nginx-website-setup-1076x694

    Thanks.

    opened by edwinyzh 0
  • Generated domain conf template is invalid - missing server

    Generated domain conf template is invalid - missing server

    2021/03/22 12:13:33 [emerg] 1#1: unexpected "{" in /etc/nginx/conf.d/testdomain.conf:1
    nginx: [emerg] unexpected "{" in /etc/nginx/conf.d/testdomain.conf:1
    

    It should include the `server {

    }` Which is missing from the template.

    opened by Ketec 1
Releases(v0.2)
  • v0.2(Jun 28, 2020)

    This version is the MVP of the nginx ui. features that are included in this release:

    • Automatic reading of configuration files as long as they are not in a nested structure.
    • Creation of new domains and the possibility to enable and disable them.
    • Documentation on securing Nginx UI
    • Responsive UI which can also be used on a tablet and mobile phone.
    Source code(tar.gz)
    Source code(zip)
Owner
David Schenk
start small. stay tuned.
David Schenk
PyTorch Implementation of Unsupervised Depth Completion with Calibrated Backprojection Layers (ORAL, ICCV 2021)

PyTorch Implementation of Unsupervised Depth Completion with Calibrated Backprojection Layers (ORAL, ICCV 2021)

80 Dec 13, 2022
Simple and extensible administrative interface framework for Flask

Flask-Admin The project was recently moved into its own organization. Please update your references to Flask-Admin 5.2k Dec 29, 2022

BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

BitcartCC 270 Jan 07, 2023
Freqtrade is a free and open source crypto trading bot written in Python

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money man

20.2k Jan 02, 2023
Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.

Xadmin Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap. Liv

差沙 4.7k Dec 31, 2022
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

1.6k Dec 28, 2022
There is a new admin bot by @sinan-m-116 .

find me on telegram! deploy me on heroku, use below button: If you can't have a config.py file (EG on heroku), it is also possible to use environment

Sinzz-sinan-m 0 Nov 09, 2021
Django Smuggler is a pluggable application for Django Web Framework that helps you to import/export fixtures via the automatically-generated administration interface.

Django Smuggler Django Smuggler is a pluggable application for Django Web Framework to easily dump/load fixtures via the automatically-generated admin

semente 373 Dec 26, 2022
Extends the Django Admin to include a extensible dashboard and navigation menu

django-admin-tools django-admin-tools is a collection of extensions/tools for the default django administration interface, it includes: a full feature

Django Admin Tools 731 Dec 28, 2022
With Django Hijack, admins can log in and work on behalf of other users without having to know their credentials.

Django Hijack With Django Hijack, admins can log in and work on behalf of other users without having to know their credentials. Docs See http://django

1.2k Jan 05, 2023
AdminFinderV1.5 - Hacking Website Admin Finder Defacer Script

Assalamualaikum Kembali Lagi bersama gua sang culun+nolep ini :v AdminFinder New

KOBUSTOR GHOST TEAM 2 Feb 15, 2022
Django app that enables staff to log in as other users using their own credentials.

Impostor Impostor is a Django application which allows staff members to login as a different user by using their own username and password. Login Logg

Andreu Vallbona Plazas 144 Dec 13, 2022
A jazzy skin for the Django Admin-Interface (official repository).

Django Grappelli A jazzy skin for the Django admin interface. Grappelli is a grid-based alternative/extension to the Django administration interface.

Patrick Kranzlmueller 3.4k Dec 31, 2022
FLEX (Federated Learning EXchange,FLEX) protocol is a set of standardized federal learning agreements designed by Tongdun AI Research Group。

Click to view Chinese version FLEX (Federated Learning Exchange) protocol is a set of standardized federal learning agreements designed by Tongdun AI

同盾科技 50 Nov 29, 2022
Manuskript is an open-source tool for writers.

Manuskript is an open-source tool for writers. Manuskript runs on GNU/Linux, Mac OS X, and Windows.

Olivier 1.4k Jan 07, 2023
A minimalist GUI frontend for the youtube-dl. Takes up less than 4 KB.

📥 libre-DL A minimalist GUI wrapper for youtube-dl. Written in python. Total size less than 4 KB. Contributions welcome. You don't need youtube-dl pr

40 Sep 23, 2022
:honey_pot: A fake Django admin login screen page.

django-admin-honeypot django-admin-honeypot is a fake Django admin login screen to log and notify admins of attempted unauthorized access. This app wa

Derek Payton 907 Dec 31, 2022
aiohttp admin is generator for admin interface based on aiohttp

aiohttp admin is generator for admin interface based on aiohttp

Mykhailo Havelia 17 Nov 16, 2022
DyStyle: Dynamic Neural Network for Multi-Attribute-Conditioned Style Editing

DyStyle: Dynamic Neural Network for Multi-Attribute-Conditioned Style Editing

74 Dec 03, 2022
Sandwich Batch Normalization

Sandwich Batch Normalization Code for Sandwich Batch Normalization. Introduction We present Sandwich Batch Normalization (SaBN), an extremely easy imp

VITA 48 Dec 15, 2022