Mini-Tutorial: Migrating from Nginx Proxy Manager to Nginx
Mini-Tutorial: Migrating from Nginx Proxy Manager to Nginx
This is an automated archive made by the Lemmit Bot.
The original was posted on /r/selfhosted by /u/Normanras on 2023-08-05 21:49:32.
For a while, I've been kicking myself because I had Nginx Proxy Manager setup but didn't really understand the underlying functionality of Nginx config files and how they work. The allure of a GUI!
As a self-hoster and homelabber, this was always on the "future todo list". Then, Christian Lempa published his video about the dangers of bringing small projects into your home lab - even as well-known ones as NPM.
I decided to make the move from NPM to Nginx and thought I'd share my experience and the steps I took with the community. I am not a content creator or any sort of professional documenter. But in my own self-hosted journey I've benefited so much from other people's blogs, websites, and write-ups, that this is just my small contribution back.
I committed the full write-up to my Github which may provide more details and insights. For those just here on Reddit, I have a short version below.
Some assumptions: I currently am using NPM with Docker and Nginx installed using Ubuntu's package manager. The file paths should be similar regardless of the hosting vehicle. I tried my best not to assume too much Linux/CLI knowledge, but if you've gotten this far, you should know some basic CLI commands including how to edit, copy, and symlink files. The full write-up has the full commands and example proxy host files.
There may be something wrong or essential that I've forgotten - I'm learning just like everyone else! Happy to incorporate changes.
tl;dr version
-
Stop both NPM and Nginx first.
systemctl stop nginx
docker stop npm
(or whatever you've named the container).
-
Copy the following contents (including sub-directories) from the NPM
/data/nginx
directory to the Nginx/etc/nginx
folder:
* `proxy_hosts` > `sites-available`
* `conf.d` > `conf.d`
* `snippets` > `snippets`
* `custom_ssl` > `custom_ssl` (if applicable)
- Edit each file in your
sites-available
directory and update the paths. Most will change from/data/nginx/
to/etc/nginx
. - Edit your
nginx.conf
file and ensure the following two paths are there:
* `include /etc/nginx/conf.d/*.conf;` and `include /etc/nginx/sites-enabled/*;`
- From within the
sites-available
directory, symlink the proxy host files insites-available
tosites-enabled
* `ln -s * ./sites-enabled`
- Test your changes with
nginx -t
. Make appropriate changes if there are error messages.
And that's it! You can now start Nginx and check for any errors using systemctl status nginx
. Good luck and happy hosting!