Nginx Proxy Manager - How-To Installation and Configuration

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I've recently made a video about setting up nginx as a reverse proxy directly on Linux but what if there was a nice and beautiful web UI that you can use to manage your entire nginx reverse proxy added multiple sites obtain trusted SSL certificates and that is running in a Docker container well that would be awesome right hi everybody my name is Christian and I create tutorials and content for it professionals I also stream every Wednesday and Thursday on Twitch so if you have any questions or you just want to continue the discussion or just hang out and chill just jump into my live streams it's always a lot of fun so in this video I will show you a very nice open source project that is called the nginx proxy manager and this is basically an engine X installation with a beautiful web UI that you can use to easily configure this as a reverse proxy you can also use this application to obtain trusted SSL certificates and it's running in a Docker container so this can be easily deployed with Docker or Docker compose or any other container management tool in this tutorial I will show you how to easily use Docker compose to deploy this application and I'm also going to expose an unsecured web application in this tutorial so this is a perfect solution for your home lab if you want to expose web applications securely or in small server environments as well in this tutorial I'm using a Ubuntu server that has already Docker and Docker compose installed if you don't know how to do that just check out my other two videos about Docker and Docker compuls there I will teach you all the fundamentals and Basics about containerization how to install that on a server and how to use it and as always you don't need to remember any commands just have a look at the video description below to my written blog article there you will find a full guide that is written on my website and you can just copy and paste any commands or template I'm going to use in this tutorial okay so let's start to deploy nginx proxy manager so I've prepared an Ubuntu 20.04 LTS server that has already Docker and Docker compose installed so let's first create a new directory in the opt path that is called engine X proxy manager and CD into this folder so now we need to create a new docker-compose.yaml file and I've already prepared one on my visual studio code I've basically just copied this from the official documentation of nginx proxy manager on GitHub but let me also explain some of the details here in this file so we will first start with the version 3 and add two Services here so the first service is called app and this is basically running the main nginx proxy manager image that is maintained by jc21 so that also exposes three parts here the port 8081 and 443 so these two parts here are for the HTTP and https services that are running on our nginx proxy manager and the port 81 is for our web interface but you probably can argue if Port 81 is the best choice for a web UI but yeah you probably could also change this to a different part if you want to and so now we need to specify the mySQL database environment variables so we need a MySQL host that is called DB so that should be the same name as our second service here don't change the port number but you can use something different for user password and database name for example and we will need two persistent volumes the first is a data folder a and the second is the let's encrypt that stores all the SSL certificates in there and then we have a second service that is called DB and that is also using a maintained image from jc21 that is using a mariadp image and you should also change the environment variables to set the root password database user and password to something more secure and then you also need to add a persistent volume that is located in our data directory with mySQL and that stores the entire database persistently so let's save this file to our remote server that is called docker-compose.yaml and if we execute an LS in this directory now we should see the file is in here so let's start the nginx proxy manager stack by executing the docker Dash compose up with a Dash D parameter that will automatically start all those services in the background and if your services are started you can just open the web interface on Port 81 so now you need to enter an email address and a password and the default email address is admin add example.com and the password is change me so click on sign in and then you first need to change the user so change that to any email address you have so for example I want to use Christian add the digital live.com click on Save and now you need to set a secure password so enter change me and choose any secured password you want to use and that's it that's pretty simple right so now we can click on the dashboard to see what we can do with this amazing software and you can see you can add many different things here for example you can add a new proxy host so when you want to expose any secured web application but you also have a redirection host where you can for example add other forward domains and you can also add streams so if you just want to do a simple nut forwarding or something like this here you can also edit access lists if you want to prevent anyone from accessing your web services and if you want to use black or white list for any specific IP addresses multiple client rules usernames and password for Access Control you can also obtain trusted SSL certificates we will do that later and of course manage different users have an audit block some global settings and so on let me also show you how to easily obtain any trusted SSL certificates with nginx proxy manager so before we can do that I will need to create a new subdomain on my DNS server that will point to the public IP address to My Cloud Server so I'm going to use the research.thedigitalife.com domain and I'm going to create this on my DNS provider so I'm using digitalocean as my DNS and cloud provider because you can easily manage your DNS server completely for free so this video is not sponsored by digitalocean but if you want to try out this you will find a referral Link in the video description below they will get 100 for 60 days if you want to try out digital ocean I think it's a great service and it also helps my channel if you try out this so on my dnso I will just add a new host name that is called research.thedigitalive.com and this will point to the public IP address of this server and digitalocean this can be easily selected here and then just create a new record so now this DNS name should point to this public IP address here and we can just use that to obtain our SSL certificate so if you want to obtain a trusted SSL certificate just click on ADD SSL certificate and enter the domain main name so in my example this is research dot the digital life.com and I would also agree to the let's encrypt terms of service so by the way I will make a separate video on Wildcard certificates and how they usually work in general with third board and also with nginx proxy manager so if you are interested in this just subscribe to the channel and ring the bell to get a notification once this video comes online okay so click on Save and this will now take a few minutes to obtain the SSL certificate and if everything was successful you should see your certificate here in this list here so we can now use that to expose any host Services here let's also expose a simple web application so I want to use nexcloud as an example which by the way is a nice software to store all your data in a private Cloud environment this is entirely hosted on your own servers but not don't use this for a production environment because this is just a simple example deployment of next Cloud if you really want to do that you would typically need to add a persistent volume and store this in a Docker compose file or something so now I want to run the next Cloud Docker container that will easily simulate a simple web application so now is very important to understand how networks work in Docker because Docker networks are isolated from each other you need to make sure that the app you want to expose is connected to the nginx proxy manager Network so when I execute Docker network list you can see all the different networks that are existing here and by default when you don't specify a network in the docker compose file Docker compost will automatically create a new network that is called like the project with an underscore default that is a bridge interface so we need to connect our nginx Cloud container in all containers we want to expose with the nginx proxy manager to this network here so I'm using a simple command to run a next Cloud container don't use this in production environment because I'm not adding a persistent storage so we will connect this Docker container to the nginx proxy manager underscore default Network this is very important and we also want to name it to next Cloud so this command is also very important because otherwise the nginx reverse proxy can not use this as a DNS name to connect to this service here and we will also use next Cloud as our Docker image and of course I also want to run this in the background here so add a Dash D parameter as well so when we now execute a Docker PS command we should see the additional next Cloud Docker container that is attached to the nginx proxy manager Network and note this doesn't expose any ports because I don't want anyone to access this container directly but instead we will use engine X proxy manager to expose this container here so let's go back to our nginx proxy manager here and add a new proxy host so now we need to enter our domain name that should be the same like in our SSL certificate otherwise we will get a certificate error so let's use the research.thedigitalive.com and now we need to select the correct scheme so now that is very important to use the correct scheme so for example for any unsecured web application that is not running on https protocol use HTTP and for any web application that is using a self-signed certificate with https choose this one here so for example next cloud is using HTTP and we will now need to enter the phone about hostname or IP address so because we have connected this Docker container to the same network like the nginx proxy manager and we have given this a service name we can easily just refer to the next cloud service so note you can never use a localhost name or the localhost IP address here because this would just refer to the docker container's internal IP address and not to the host operating system address so you will definitely need to enter an IP address here or a service name of a container this is attached to the same Docker Network also add the forward pod that is Port ad by default and I also want to add the block common export Lloyds so we will add some protection to our server that is blocking some common malicious exploits on our website here and you can also use custom locations that are pretty cool because you extend the path and you can add specific locations for different paths and so forth but for this example we don't need this now we will need to add the SSL certificate so we will select our search.thedigitalife.com let's encrypt certificate and of course we want to force SSL we will add HTTP 2 support and hsts enabled we could also add some custom nginx configuration for example if you want to change some header attributes here also on but for this example we can just click on Save here and if you click on this link here you should see the welcome page of nexcloud or your web application that you have Exposed on your nginx proxy manager and if you've done everything right it should just work fine and if you still can't get it to work just join our Discord community and just ask any questions so a quick shout out to everybody on my Discord Community you are awesome and if this video was helpful to you guys please don't forget to hit the like button and subscribe to this channel if you want to see more tutorials and content for it professionals so before I go I want to give a quick shout out to all my supporters on patreon especially Mason who is the producer of this show and if you want to support my mission to help as many people as possible to jump in the field of it and become real it professionals just support me on patreon so thanks everybody for watching enjoy the rest of your day take care of yourself and I see you soon
Info
Channel: The Digital Life
Views: 219,664
Rating: undefined out of 5
Keywords: nginx proxy manager how to, nginx proxy manager, nginx-proxy-manager, nginx proxy manager docker, nginx proxy manager https, nginx proxy manager portainer, nginx proxy manager ssl, nginx proxy manager tutorial, docker nginx proxy manager, how to use nginx proxy manager, setup nginx proxy manager, Docker NGINX proxy, self hosting
Id: P3imFC7GSr0
Channel Id: undefined
Length: 12min 14sec (734 seconds)
Published: Sun Dec 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.