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
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
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
A high-level app and dashboarding solution for Python

Panel provides tools for easily composing widgets, plots, tables, and other viewable objects and controls into custom analysis tools, apps, and dashboards.

HoloViz 2.5k Jan 03, 2023
A python application for manipulating pandas data frames from the comfort of your web browser

A python application for manipulating pandas data frames from the comfort of your web browser. Data flows are represented as a Directed Acyclic Graph, and nodes can be ran individually as the user se

Schlerp 161 Jan 04, 2023
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Chris Chang 524 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
Nginx UI allows you to access and modify the nginx configurations files without cli.

nginx ui Table of Contents nginx ui Introduction Setup Example Docker UI Authentication Configure the auth file Configure nginx Introduction We use ng

David Schenk 4.3k Dec 31, 2022
WordPress look and feel for Django administration panel

Django WP Admin WordPress look and feel for Django administration panel. Features WordPress look and feel New styles for selector, calendar and timepi

Maciej Marczewski 266 Nov 21, 2022
xarray: N-D labeled arrays and datasets

xarray is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!

Python for Data 2.8k Dec 29, 2022
Firebase Admin Console is a centralized platform for easy viewing and maintenance of Firestore database, the back-end API is a Python Flask app.

Firebase Admin Console is a centralized platform for easy viewing and maintenance of Firestore database, the back-end API is a Python Flask app. A starting template for developers to customize, build

Daqi Chen 1 Sep 10, 2022
"Log in as user" for the Django admin.

django-loginas About "Login as user" for the Django admin. loginas supports Python 3 only, as of version 0.4. If you're on 2, use 0.3.6. Installing dj

Stavros Korokithakis 326 Dec 03, 2022
Responsive Theme for Django Admin With Sidebar Menu

Responsive Django Admin If you're looking for a version compatible with Django 1.8 just install 0.3.7.1. Features Responsive Sidebar Menu Easy install

Douglas Miranda 852 Dec 02, 2022
A new style for Django admin

Djamin Djamin a new and clean styles for Django admin based in Google projects styles. Quick start Install djamin: pip install -e git://github.com/her

Herson Leite 236 Dec 15, 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
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
EOD (Easy and Efficient Object Detection) is a general object detection model production framework.

EOD (Easy and Efficient Object Detection) is a general object detection model production framework.

383 Jan 07, 2023
Tornadmin is an admin site generation framework for Tornado web server.

Tornadmin is an admin site generation framework for Tornado web server.

Bharat Chauhan 0 Jan 10, 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
A cool, modern and responsive django admin application based on bootstrap 5

django-baton A cool, modern and responsive django admin application based on bootstrap 5 Documentation: readthedocs Live Demo Now you can try django-b

Otto srl 678 Jan 01, 2023
FastAPI Admin Dashboard based on FastAPI and Tortoise ORM.

FastAPI ADMIN 中文文档 Introduction FastAPI-Admin is a admin dashboard based on fastapi and tortoise-orm. FastAPI-Admin provide crud feature out-of-the-bo

long2ice 1.6k Jan 02, 2023