First post up! I can't get CSS or JS to load via an nginx server though. The MIME type isn't supported. Looks like others are having issues, but no answers yet.
This commit is contained in:
245
content/posts/npm_to_nginx_tutorial.md
Normal file
245
content/posts/npm_to_nginx_tutorial.md
Normal file
@ -0,0 +1,245 @@
|
||||
+++
|
||||
title = 'Tutorial: Move from NginxProxyManager to Nginx'
|
||||
date = 2023-08-05T15:23:51-05:00
|
||||
draft = false
|
||||
tags = ["tutorial", "self-hosted", ]
|
||||
+++
|
||||
|
||||
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for [this reddit
|
||||
post](https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/) and to post this [my Github profile](https://github.com/Normanras/Npm_to_Nginx). Thought my website would also be a good place to share it for any passers-by.
|
||||
|
||||
## Goal
|
||||
|
||||
To give clear instructions to help users migrate from using [Nginx Proxy Manager](https://nginxproxymanager.com/) (NPM) to standard [Nginx](https://docs.nginx.com/). This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx [Documentation Sites](http://nginx.org/en/docs/) and tutorials to learn more.
|
||||
|
||||
### Introduction
|
||||
|
||||
If you're anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you've likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you've also been paying attention to various self-hosted communities, you may have also come across Christian Lempa's Video on [trusting smaller self hosted projects and tools](https://youtu.be/uaixCKTaqY0).
|
||||
|
||||
*Spoilers:* He roasts NPM in his video and towards the end says he won't be using NPM anymore. He also, perhaps purposely, doesn't share which tool he will be migrating to.
|
||||
|
||||
Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn't taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.
|
||||
|
||||
*Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you'd like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.*
|
||||
|
||||
### TL;DR - Quick Steps
|
||||
|
||||
1. 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)
|
||||
|
||||
2. Edit each file in your `sites-available` directory and update the paths. Most will change from `/data/nginx/` to `/etc/nginx`.
|
||||
3. 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/*;`
|
||||
|
||||
4. Symlink the proxy host files in `sites-available` to `sites-enabled`
|
||||
|
||||
* `ln -s * ./sites-enabled`
|
||||
|
||||
5. Test your changes with `nginx -t`. Make appropriate changes if there are error messages.
|
||||
|
||||
### Pre-requisites & Assumptions
|
||||
|
||||
I am using an Ubuntu VM with NPM and it's db as a Docker Container while Nginx is installed natively on the machine. You don't have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.
|
||||
|
||||
I've added some example files to show before and after changes to this repo and outlined file trees below.
|
||||
|
||||
* You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).
|
||||
* You've installed [NPM](https://nginxproxymanager.com/setup/) and [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) using your preferred method.
|
||||
* You have access to both NPMs file tree and Nginx's.
|
||||
* If using NPM in docker, make sure you've mapped a local volume on the host to the container.
|
||||
* My setup using docker-compose is the following: `/user/nginx/data:/data`.
|
||||
* Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.
|
||||
* For a linux install, they should be accessible at `/etc/nginx`.
|
||||
* You know how to edit files at the command line using `nano`, `vi`, `vim`, `neovim`, `emacs`, or something else.
|
||||
|
||||
### Nginx Files
|
||||
|
||||
Nginx uses the `nginx.conf` file and within that file, it will include your proxy files. These exist under `./nginx/sites-enabled/`. In the main `nginx.conf` file, the line `include /etc/nginx/sites-enabled/*;` will bring in those files to the config file, making the proxies accessible.
|
||||
|
||||
### How to Transition - Detailed Version
|
||||
|
||||
1. Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.
|
||||
|
||||
* Docker: `docker stop [app_container, db_container]`
|
||||
* Systemd: `systemctl stop nginx`
|
||||
|
||||
2. Copy your `proxy_host` (NPM) files to the `sites-available` (Nginx) folder.
|
||||
`cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/`
|
||||
|
||||
3. Nginx doesn't really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.
|
||||
|
||||
4. Copy your `custom_ssl` folder from NPM to the `custom_ssl` folder in Nginx. See the following step for the various default paths in both systems.
|
||||
|
||||
* `cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/`
|
||||
|
||||
5. Copy the `conf.d` folder from NPM to the `conf.d` folder in Nginx. *Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my `conf.d` directory. If you're missing any files, please download and/or copy and
|
||||
paste them from the [NPM Repo](https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include)*
|
||||
|
||||
* `cp -r /user/nginx/data/nginx/conf.d /etc/nginx/`
|
||||
|
||||
6. If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the `snippets` directory.
|
||||
|
||||
* `cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/`
|
||||
|
||||
7. There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I've placed additional comments in [`./proxy_host/npm_proxy.conf`](./proxy_host/npm_proxy.conf) file. The line changes are the following:
|
||||
|
||||
1. Custom SSL path:
|
||||
|
||||
* NPM path: `/data/custom_ssl...`
|
||||
* Nginx path: `/etc/nginx/custom_ssl...`
|
||||
|
||||
2. conf.d:
|
||||
|
||||
* The paths should remain the same. However, if you changed the path for `conf.d` in Nginx and differed in step 5, above, make sure you use the correct path.
|
||||
|
||||
3. Access & Error Logs
|
||||
|
||||
* NPM path: `/data/logs/...`
|
||||
* Nginx path: `/var/log/nginx/...`
|
||||
|
||||
8. Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.
|
||||
9. Navigate to the `nginx.conf` file which is located at `/etc/nginx/`. You can see the one I am using in this repo.
|
||||
10. Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.
|
||||
* `include /etc/nginx/conf.d/*.conf;` and `include /etc/nginx/sites-enabled/*;`
|
||||
11. You'll notice that you ensured there was a `sites-enabled` directory in the configuration file, but you changed all your proxy host config files in `sites-available`! Good eye, all that's left is to symlink the files to `sites-enabled` so that nginx can start using them.
|
||||
12. To symlink the available proxy files run the following command within the `sites-available` directory:
|
||||
* `ln -s * ./sites-enabled`
|
||||
13. Once you're confident that you've done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your `nginx.conf` file - usually `/etc/nginx` - run the following command: `nginx -t`.
|
||||
14. If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there's a high likelihood that it will be path error.
|
||||
|
||||
```bash
|
||||
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
```
|
||||
|
||||
And that's it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system's status should nginx fail to start.
|
||||
|
||||
### Additional Information/Appendix
|
||||
|
||||
#### File Trees for NPM (in container) and Nginx (on host)
|
||||
|
||||
*I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.*
|
||||
|
||||
#### NGINX
|
||||
|
||||
```bash
|
||||
├── conf.d
|
||||
│ └── include
|
||||
│ ├── assets.conf
|
||||
│ ├── block-exploits.conf
|
||||
│ ├── force-ssl.conf
|
||||
│ ├── ip_ranges.conf
|
||||
│ ├── proxy.conf
|
||||
│ └── resolvers.conf
|
||||
├── custom_ssl
|
||||
│ ├── npm-1
|
||||
│ │ ├── fullchain.pem
|
||||
│ │ └── privkey.pem
|
||||
│ ├── npm-2
|
||||
│ │ ├── fullchain.pem
|
||||
│ │ └── privkey.pem
|
||||
│ └── npm-3
|
||||
│ ├── fullchain.pem
|
||||
│ └── privkey.pem
|
||||
├── fastcgi.conf
|
||||
├── fastcgi_params
|
||||
├── koi-utf
|
||||
├── koi-win
|
||||
├── mime.types
|
||||
├── modules-available
|
||||
├── modules-enabled
|
||||
├── nginx.conf
|
||||
├── proxy_params
|
||||
├── scgi_params
|
||||
├── sites-available
|
||||
│ ├── auth.conf
|
||||
│ ├── bitwarden.conf
|
||||
│ ├── codehub.conf
|
||||
│ ├── default.backup
|
||||
│ ├── files.conf
|
||||
│ ├── notes.conf
|
||||
│ ├── photos.conf
|
||||
│ ├── rsmsn-root.conf
|
||||
│ ├── wordle.conf
|
||||
│ └── wordle-it.conf
|
||||
├── sites-enabled
|
||||
│ ├── auth.conf -> /etc/nginx/sites-available/auth.conf
|
||||
│ ├── bitwarden.conf -> /etc/nginx/sites-available/bitwarden.conf
|
||||
│ ├── codehub.conf -> /etc/nginx/sites-available/codehub.conf
|
||||
│ ├── files.conf -> /etc/nginx/sites-available/files.conf
|
||||
│ ├── notes.conf -> /etc/nginx/sites-available/notes.conf
|
||||
│ ├── photos.conf -> /etc/nginx/sites-available/photos.conf
|
||||
│ ├── wordle.conf -> /etc/nginx/sites-available/wordle.conf
|
||||
│ └── wordle-it.conf -> /etc/nginx/sites-available/wordle-it.conf
|
||||
├── snippets
|
||||
│ ├── authelia-authrequest-basic.conf
|
||||
│ ├── authelia-authrequest.conf
|
||||
│ ├── authelia-authrequest-detect.conf
|
||||
│ ├── authelia-location-basic.conf
|
||||
│ ├── authelia-location.conf
|
||||
│ ├── authelia-location-detect.conf
|
||||
│ ├── fastcgi-php.conf
|
||||
│ ├── proxy.conf
|
||||
│ └── snakeoil.conf
|
||||
├── uwsgi_params
|
||||
└── win-utf
|
||||
```
|
||||
|
||||
#### NPM
|
||||
|
||||
```bash
|
||||
├── data
|
||||
│ ├── access
|
||||
│ ├── custom_ssl
|
||||
│ │ ├── npm-1
|
||||
│ │ │ ├── fullchain.pem
|
||||
│ │ │ └── privkey.pem
|
||||
│ │ ├── npm-2
|
||||
│ │ │ ├── fullchain.pem
|
||||
│ │ │ └── privkey.pem
|
||||
│ │ └── npm-3
|
||||
│ │ ├── fullchain.pem
|
||||
│ │ └── privkey.pem
|
||||
│ ├── keys.json
|
||||
│ ├── letsencrypt-acme-challenge
|
||||
│ ├── logs
|
||||
│ ├── mysql
|
||||
│ └── nginx
|
||||
│ ├── custom
|
||||
│ ├── dead_host
|
||||
│ ├── default_host
|
||||
│ ├── default_www
|
||||
│ ├── dummycert.pem
|
||||
│ ├── dummykey.pem
|
||||
│ ├── proxy_host
|
||||
│ │ ├── 10.conf
|
||||
│ │ ├── 11.conf
|
||||
│ │ ├── 12.conf
|
||||
│ │ ├── 13.conf
|
||||
│ │ ├── 15.conf
|
||||
│ │ ├── 1.conf
|
||||
│ │ ├── 2.conf
|
||||
│ │ ├── 4.conf
|
||||
│ │ ├── 5.conf
|
||||
│ │ └── 6.conf
|
||||
│ ├── redirection_host
|
||||
│ ├── snippets
|
||||
│ │ ├── authelia-authrequest-basic.conf
|
||||
│ │ ├── authelia-authrequest.conf
|
||||
│ │ ├── authelia-authrequest-detect.conf
|
||||
│ │ ├── authelia-location-basic.conf
|
||||
│ │ ├── authelia-location.conf
|
||||
│ │ ├── authelia-location-detect.conf
|
||||
│ │ └── proxy.conf
|
||||
│ ├── stream
|
||||
│ └── temp
|
||||
├── docker-compose.yml
|
||||
└── letsencrypt
|
||||
└── renewal-hooks
|
||||
```
|
||||
56
dark-theme-config.toml
Normal file
56
dark-theme-config.toml
Normal file
@ -0,0 +1,56 @@
|
||||
[params]
|
||||
[params.site]
|
||||
faviconUrl = ""
|
||||
localCss = []
|
||||
externalCss = []
|
||||
localJs = []
|
||||
externalJs = []
|
||||
[params.header]
|
||||
title = "My New Hugo Site"
|
||||
subtitle = "A Site Built by Hugo"
|
||||
[params.header.logo]
|
||||
imgUrl = ""
|
||||
logoLink = ""
|
||||
|
||||
[params.footer]
|
||||
copyrightStr = "All Rights Reserved ®."
|
||||
counter = true
|
||||
language = true
|
||||
hugoVersion = true
|
||||
theme = true
|
||||
modifiedTime = true
|
||||
dateFormat = "Jan 02 2006 15:04:05"
|
||||
gitHash = true
|
||||
|
||||
[params.footer.socialLink]
|
||||
github = ""
|
||||
facebook = ""
|
||||
twitter = ""
|
||||
email = ""
|
||||
linkedin = ""
|
||||
instagram = ""
|
||||
telegram = ""
|
||||
medium = ""
|
||||
vimeo = ""
|
||||
youtube = ""
|
||||
|
||||
[params.globalFrontmatter]
|
||||
author = "Jing Wang"
|
||||
description = "This is my new hugo site"
|
||||
keywords = "hugo,site,new"
|
||||
|
||||
[params.homePage]
|
||||
siteLongDescription = "Hugo is a fast and easy-to-use static website generator written in Go. It renders a complete HTML website from content and templates in a directory, utilizing Markdown files for metadata. It's optimized for speed and suitable for various website types."
|
||||
|
||||
siteLongDescriptionTitle = "Start"
|
||||
showRecentPostsBlock = true
|
||||
numOfRecentPosts = 5
|
||||
recentPostShowUrl = true
|
||||
|
||||
[params.page]
|
||||
includeToc = true
|
||||
showAuthor = true
|
||||
showDate = true
|
||||
dateFormat = "2006.01.02"
|
||||
showTimeToRead = true
|
||||
showBreadcrumb = true
|
||||
14
hugo.toml
14
hugo.toml
@ -1,8 +1,13 @@
|
||||
baseURL = 'localhost'
|
||||
baseURL = 'https://selfhosted.rsmsn.co/'
|
||||
relativeURLs = true
|
||||
languageCode = 'en-us'
|
||||
title = 'Rsmsn Blog'
|
||||
subtitle = 'A mostly technical blog & series of experiences working in tech and my homelab'
|
||||
theme = 'dark-theme-editor'
|
||||
theme = 'terminal'
|
||||
themesDir = './themes/'
|
||||
|
||||
[params]
|
||||
dateFormat = "02 Jan 2006"
|
||||
|
||||
[params.globalFrontmatter]
|
||||
author = "Norm Rasmussen"
|
||||
@ -13,6 +18,9 @@ theme = 'dark-theme-editor'
|
||||
includeToc = true
|
||||
showAuthor = true
|
||||
showDate = true
|
||||
dateFormate = "2023.09.14"
|
||||
showTimeToRead = true
|
||||
showBreadcrumb = true
|
||||
|
||||
[mediaTypes]
|
||||
[mediaTypes."application/javascript"]
|
||||
suffixes = ["js","jsm","mjs"]
|
||||
|
||||
132
public/404.html
Normal file
132
public/404.html
Normal file
@ -0,0 +1,132 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>404 Page not found :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/404.html" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="404 Page not found">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/404.html" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="post">
|
||||
<h1 class="post-title">404 — Page not found...</h1>
|
||||
|
||||
<div class="post-content">
|
||||
<a href="https://selfhosted.rsmsn.co/">Back to home page →</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="./bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
45
public/bundle.min.js
vendored
Normal file
45
public/bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
134
public/categories/index.html
Normal file
134
public/categories/index.html
Normal file
@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>Categories :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/categories/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Categories">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/categories/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="../categories/index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="terms">
|
||||
<h1>Categories</h1>
|
||||
|
||||
<ul>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
public/categories/index.xml
Normal file
10
public/categories/index.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Categories on Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/categories/</link>
|
||||
<description>Recent content in Categories on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language><atom:link href="https://selfhosted.rsmsn.co/categories/index.xml" rel="self" type="application/rss+xml" />
|
||||
</channel>
|
||||
</rss>
|
||||
File diff suppressed because one or more lines are too long
BIN
public/fonts/FiraCode-Bold.woff
Normal file
BIN
public/fonts/FiraCode-Bold.woff
Normal file
Binary file not shown.
BIN
public/fonts/FiraCode-Regular.woff
Normal file
BIN
public/fonts/FiraCode-Regular.woff
Normal file
Binary file not shown.
BIN
public/img/theme-colors/blue.png
Normal file
BIN
public/img/theme-colors/blue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 B |
BIN
public/img/theme-colors/green.png
Normal file
BIN
public/img/theme-colors/green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
BIN
public/img/theme-colors/orange.png
Normal file
BIN
public/img/theme-colors/orange.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
BIN
public/img/theme-colors/pink.png
Normal file
BIN
public/img/theme-colors/pink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
BIN
public/img/theme-colors/red.png
Normal file
BIN
public/img/theme-colors/red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 B |
182
public/index.html
Normal file
182
public/index.html
Normal file
@ -0,0 +1,182 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="generator" content="Hugo 0.118.2">
|
||||
|
||||
<title>Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Rsmsn Blog">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="./index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="posts">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<article class="post on-list">
|
||||
<h1 class="post-title">
|
||||
<a href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/">Tutorial: Move from NginxProxyManager to Nginx</a>
|
||||
</h1>
|
||||
|
||||
<div class="post-meta"><time class="post-date">2023-08-05</time></div>
|
||||
|
||||
|
||||
<span class="post-tags">
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial</a>
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted</a>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<a class="read-more button" href="./posts/npm_to_nginx_tutorial/"> →</a>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination__buttons">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="./bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
281
public/index.xml
Normal file
281
public/index.xml
Normal file
@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/</link>
|
||||
<description>Recent content on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Sat, 05 Aug 2023 15:23:51 -0500</lastBuildDate><atom:link href="https://selfhosted.rsmsn.co/index.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>Tutorial: Move from NginxProxyManager to Nginx</title>
|
||||
<link>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</guid>
|
||||
<description>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.</description>
|
||||
<content><p>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for <a href="https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/">this reddit
|
||||
post</a> and to post this <a href="https://github.com/Normanras/Npm_to_Nginx">my Github profile</a>. Thought my website would also be a good place to share it for any passers-by.</p>
|
||||
<h2 id="goal">Goal</h2>
|
||||
<p>To give clear instructions to help users migrate from using <a href="https://nginxproxymanager.com/">Nginx Proxy Manager</a> (NPM) to standard <a href="https://docs.nginx.com/">Nginx</a>. This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx <a href="http://nginx.org/en/docs/">Documentation Sites</a> and tutorials to learn more.</p>
|
||||
<h3 id="introduction">Introduction</h3>
|
||||
<p>If you&rsquo;re anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you&rsquo;ve likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you&rsquo;ve also been paying attention to various self-hosted communities, you may have also come across Christian Lempa&rsquo;s Video on <a href="https://youtu.be/uaixCKTaqY0">trusting smaller self hosted projects and tools</a>.</p>
|
||||
<p><em>Spoilers:</em> He roasts NPM in his video and towards the end says he won&rsquo;t be using NPM anymore. He also, perhaps purposely, doesn&rsquo;t share which tool he will be migrating to.</p>
|
||||
<p>Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn&rsquo;t taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.</p>
|
||||
<p><em>Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you&rsquo;d like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.</em></p>
|
||||
<h3 id="tldr---quick-steps">TL;DR - Quick Steps</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Copy the following contents (including sub-directories) from the NPM <code>/data/nginx</code> directory to the Nginx <code>/etc/nginx</code> folder:</p>
|
||||
<ul>
|
||||
<li><code>proxy_hosts</code> &gt; <code>sites-available</code></li>
|
||||
<li><code>conf.d</code> &gt; <code>conf.d</code></li>
|
||||
<li><code>snippets</code> &gt; <code>snippets</code></li>
|
||||
<li><code>custom_ssl</code> &gt; <code>custom_ssl</code> (if applicable)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit each file in your <code>sites-available</code> directory and update the paths. Most will change from <code>/data/nginx/</code> to <code>/etc/nginx</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit your <code>nginx.conf</code> file and ensure the following two paths are there:</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symlink the proxy host files in <code>sites-available</code> to <code>sites-enabled</code></p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Test your changes with <code>nginx -t</code>. Make appropriate changes if there are error messages.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h3 id="pre-requisites--assumptions">Pre-requisites &amp; Assumptions</h3>
|
||||
<p>I am using an Ubuntu VM with NPM and it&rsquo;s db as a Docker Container while Nginx is installed natively on the machine. You don&rsquo;t have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.</p>
|
||||
<p>I&rsquo;ve added some example files to show before and after changes to this repo and outlined file trees below.</p>
|
||||
<ul>
|
||||
<li>You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).</li>
|
||||
<li>You&rsquo;ve installed <a href="https://nginxproxymanager.com/setup/">NPM</a> and <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">Nginx</a> using your preferred method.</li>
|
||||
<li>You have access to both NPMs file tree and Nginx&rsquo;s.</li>
|
||||
<li>If using NPM in docker, make sure you&rsquo;ve mapped a local volume on the host to the container.</li>
|
||||
<li>My setup using docker-compose is the following: <code>/user/nginx/data:/data</code>.</li>
|
||||
<li>Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.</li>
|
||||
<li>For a linux install, they should be accessible at <code>/etc/nginx</code>.</li>
|
||||
<li>You know how to edit files at the command line using <code>nano</code>, <code>vi</code>, <code>vim</code>, <code>neovim</code>, <code>emacs</code>, or something else.</li>
|
||||
</ul>
|
||||
<h3 id="nginx-files">Nginx Files</h3>
|
||||
<p>Nginx uses the <code>nginx.conf</code> file and within that file, it will include your proxy files. These exist under <code>./nginx/sites-enabled/</code>. In the main <code>nginx.conf</code> file, the line <code>include /etc/nginx/sites-enabled/*;</code> will bring in those files to the config file, making the proxies accessible.</p>
|
||||
<h3 id="how-to-transition---detailed-version">How to Transition - Detailed Version</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.</p>
|
||||
<ul>
|
||||
<li>Docker: <code>docker stop [app_container, db_container]</code></li>
|
||||
<li>Systemd: <code>systemctl stop nginx</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>proxy_host</code> (NPM) files to the <code>sites-available</code> (Nginx) folder.
|
||||
<code>cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Nginx doesn&rsquo;t really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>custom_ssl</code> folder from NPM to the <code>custom_ssl</code> folder in Nginx. See the following step for the various default paths in both systems.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy the <code>conf.d</code> folder from NPM to the <code>conf.d</code> folder in Nginx. <em>Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my <code>conf.d</code> directory. If you&rsquo;re missing any files, please download and/or copy and
|
||||
paste them from the <a href="https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include">NPM Repo</a></em></p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/conf.d /etc/nginx/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the <code>snippets</code> directory.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I&rsquo;ve placed additional comments in <a href="./proxy_host/npm_proxy.conf"><code>./proxy_host/npm_proxy.conf</code></a> file. The line changes are the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Custom SSL path:</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/custom_ssl...</code></li>
|
||||
<li>Nginx path: <code>/etc/nginx/custom_ssl...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>conf.d:</p>
|
||||
<ul>
|
||||
<li>The paths should remain the same. However, if you changed the path for <code>conf.d</code> in Nginx and differed in step 5, above, make sure you use the correct path.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Access &amp; Error Logs</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/logs/...</code></li>
|
||||
<li>Nginx path: <code>/var/log/nginx/...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p>Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Navigate to the <code>nginx.conf</code> file which is located at <code>/etc/nginx/</code>. You can see the one I am using in this repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>You&rsquo;ll notice that you ensured there was a <code>sites-enabled</code> directory in the configuration file, but you changed all your proxy host config files in <code>sites-available</code>! Good eye, all that&rsquo;s left is to symlink the files to <code>sites-enabled</code> so that nginx can start using them.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>To symlink the available proxy files run the following command within the <code>sites-available</code> directory:</p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once you&rsquo;re confident that you&rsquo;ve done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your <code>nginx.conf</code> file - usually <code>/etc/nginx</code> - run the following command: <code>nginx -t</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there&rsquo;s a high likelihood that it will be path error.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
</span></span><span style="display:flex;"><span>nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
</span></span></code></pre></div><p>And that&rsquo;s it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system&rsquo;s status should nginx fail to start.</p>
|
||||
<h3 id="additional-informationappendix">Additional Information/Appendix</h3>
|
||||
<h4 id="file-trees-for-npm-in-container-and-nginx-on-host">File Trees for NPM (in container) and Nginx (on host)</h4>
|
||||
<p><em>I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.</em></p>
|
||||
<h4 id="nginx">NGINX</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── conf.d
|
||||
</span></span><span style="display:flex;"><span>│ └── include
|
||||
</span></span><span style="display:flex;"><span>│ ├── assets.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── block-exploits.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── force-ssl.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── ip_ranges.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── resolvers.conf
|
||||
</span></span><span style="display:flex;"><span>├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi.conf
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi_params
|
||||
</span></span><span style="display:flex;"><span>├── koi-utf
|
||||
</span></span><span style="display:flex;"><span>├── koi-win
|
||||
</span></span><span style="display:flex;"><span>├── mime.types
|
||||
</span></span><span style="display:flex;"><span>├── modules-available
|
||||
</span></span><span style="display:flex;"><span>├── modules-enabled
|
||||
</span></span><span style="display:flex;"><span>├── nginx.conf
|
||||
</span></span><span style="display:flex;"><span>├── proxy_params
|
||||
</span></span><span style="display:flex;"><span>├── scgi_params
|
||||
</span></span><span style="display:flex;"><span>├── sites-available
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── default.backup
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── rsmsn-root.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── sites-enabled
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf -&gt; /etc/nginx/sites-available/auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf -&gt; /etc/nginx/sites-available/bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf -&gt; /etc/nginx/sites-available/codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf -&gt; /etc/nginx/sites-available/files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf -&gt; /etc/nginx/sites-available/notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf -&gt; /etc/nginx/sites-available/photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf -&gt; /etc/nginx/sites-available/wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf -&gt; /etc/nginx/sites-available/wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── fastcgi-php.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── snakeoil.conf
|
||||
</span></span><span style="display:flex;"><span>├── uwsgi_params
|
||||
</span></span><span style="display:flex;"><span>└── win-utf
|
||||
</span></span></code></pre></div><h4 id="npm">NPM</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── data
|
||||
</span></span><span style="display:flex;"><span>│ ├── access
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── keys.json
|
||||
</span></span><span style="display:flex;"><span>│ ├── letsencrypt-acme-challenge
|
||||
</span></span><span style="display:flex;"><span>│ ├── logs
|
||||
</span></span><span style="display:flex;"><span>│ ├── mysql
|
||||
</span></span><span style="display:flex;"><span>│ └── nginx
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom
|
||||
</span></span><span style="display:flex;"><span>│ ├── dead_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_www
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummycert.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummykey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy_host
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 10.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 11.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 12.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 13.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 15.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 1.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 2.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 4.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 5.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── 6.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── redirection_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── stream
|
||||
</span></span><span style="display:flex;"><span>│ └── temp
|
||||
</span></span><span style="display:flex;"><span>├── docker-compose.yml
|
||||
</span></span><span style="display:flex;"><span>└── letsencrypt
|
||||
</span></span><span style="display:flex;"><span>└── renewal-hooks
|
||||
</span></span></code></pre></div></content>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
@ -0,0 +1 @@
|
||||
let isSidebarExpand=!1,isSidebarShow=!1;function isSidebarExpandStart(){isSidebarExpand=!0}function isSidebarExpandEnd(){isSidebarExpand=!1}function isSidebarExpanding(e){if(!isSidebarExpand)return;const t=e.pageX/window.innerWidth*100;if(t>10&&t<50){const e=100-t;document.querySelector("aside.sidebar").style.width=`${t}%`;const n=getComputedStyle(document.querySelector("article.main")).getPropertyValue("--artile_main_width"),s=n.replace(/[\d.]+/,e);document.querySelector("article.main").style.setProperty("--artile_main_width",s)}}function showSidebar(){document.querySelector("aside.sidebar").style.display="block",isSidebarShow=!0,document.querySelector("button.sidebar-toggle-btn").setAttribute("aria-expanded","true")}function hideSidebar(){isSidebarShow&&(document.querySelector("aside.sidebar").style.display="",isSidebarShow=!1,document.querySelector("button.sidebar-toggle-btn").setAttribute("aria-expanded","false"))}window.addEventListener("load",function(){document.querySelectorAll("button.copy-button").forEach(e=>{e.addEventListener("click",e=>{let t=e.currentTarget;t.getAttribute("state")==="copy"&&(navigator.clipboard.writeText(decodeURI(t.getAttribute("data"))),t.setAttribute("state","copied"),t.textContent="Copied !",window.setTimeout(()=>{t.setAttribute("state","copy"),t.textContent="Copy"},3*1e3))})}),document.querySelector("aside.exapandable").addEventListener("mousedown",isSidebarExpandStart),document.querySelector("aside.exapandable").addEventListener("touchstart",isSidebarExpandStart),window.addEventListener("mousemove",isSidebarExpanding),window.addEventListener("touchmove",isSidebarExpanding),window.addEventListener("mouseup",isSidebarExpandEnd),window.addEventListener("touchend",isSidebarExpandEnd),document.querySelector("button.sidebar-toggle-btn").addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),e.currentTarget.getAttribute("aria-expanded")==="true"?hideSidebar():showSidebar()}),this.document.querySelector("article.main").addEventListener("click",hideSidebar),this.document.querySelector("article.main").addEventListener("touchstart",hideSidebar),this.document.querySelector("article.main").addEventListener("mousedown",hideSidebar),this.window.addEventListener("resize",()=>{window.innerWidth>900&&(isSidebarShow=!1,document.querySelector("aside.sidebar").style.display="",document.querySelector("button.sidebar-toggle-btn").setAttribute("aria-expanded","false"))}),this.window.addEventListener("resize",()=>{let e=document.querySelector("article.main");const t=e.style.getPropertyValue("--artile_main_width");if(t){const n=t.match(/[\d.]+/)[0];e.style.setProperty("--artile_main_width","");const s=getComputedStyle(e).getPropertyValue("--artile_main_width").replace(/[\d.]+/,n);e.style.setProperty("--artile_main_width",s)}}),document.querySelectorAll("li.dir > span.dir-text").forEach(e=>{e.addEventListener("click",function(){this.parentNode.classList.toggle("opened-dir"),this.parentNode.classList.toggle("closed-dir")})})})
|
||||
10
public/page/1/index.html
Normal file
10
public/page/1/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>https://selfhosted.rsmsn.co/</title>
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://selfhosted.rsmsn.co/">
|
||||
</head>
|
||||
</html>
|
||||
171
public/posts/index.html
Normal file
171
public/posts/index.html
Normal file
@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>Posts :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/posts/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Posts">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/posts/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="../posts/index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="posts">
|
||||
|
||||
<article class="post on-list">
|
||||
<h1 class="post-title">
|
||||
<a href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/">Tutorial: Move from NginxProxyManager to Nginx</a>
|
||||
</h1>
|
||||
<div class="post-meta"><time class="post-date">2023-08-05</time></div>
|
||||
|
||||
|
||||
<span class="post-tags">
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial</a>
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted</a>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<a class="read-more button" href="../posts/npm_to_nginx_tutorial/"> →</a>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination__buttons">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
281
public/posts/index.xml
Normal file
281
public/posts/index.xml
Normal file
@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Posts on Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/posts/</link>
|
||||
<description>Recent content in Posts on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Sat, 05 Aug 2023 15:23:51 -0500</lastBuildDate><atom:link href="https://selfhosted.rsmsn.co/posts/index.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>Tutorial: Move from NginxProxyManager to Nginx</title>
|
||||
<link>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</guid>
|
||||
<description>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.</description>
|
||||
<content><p>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for <a href="https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/">this reddit
|
||||
post</a> and to post this <a href="https://github.com/Normanras/Npm_to_Nginx">my Github profile</a>. Thought my website would also be a good place to share it for any passers-by.</p>
|
||||
<h2 id="goal">Goal</h2>
|
||||
<p>To give clear instructions to help users migrate from using <a href="https://nginxproxymanager.com/">Nginx Proxy Manager</a> (NPM) to standard <a href="https://docs.nginx.com/">Nginx</a>. This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx <a href="http://nginx.org/en/docs/">Documentation Sites</a> and tutorials to learn more.</p>
|
||||
<h3 id="introduction">Introduction</h3>
|
||||
<p>If you&rsquo;re anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you&rsquo;ve likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you&rsquo;ve also been paying attention to various self-hosted communities, you may have also come across Christian Lempa&rsquo;s Video on <a href="https://youtu.be/uaixCKTaqY0">trusting smaller self hosted projects and tools</a>.</p>
|
||||
<p><em>Spoilers:</em> He roasts NPM in his video and towards the end says he won&rsquo;t be using NPM anymore. He also, perhaps purposely, doesn&rsquo;t share which tool he will be migrating to.</p>
|
||||
<p>Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn&rsquo;t taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.</p>
|
||||
<p><em>Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you&rsquo;d like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.</em></p>
|
||||
<h3 id="tldr---quick-steps">TL;DR - Quick Steps</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Copy the following contents (including sub-directories) from the NPM <code>/data/nginx</code> directory to the Nginx <code>/etc/nginx</code> folder:</p>
|
||||
<ul>
|
||||
<li><code>proxy_hosts</code> &gt; <code>sites-available</code></li>
|
||||
<li><code>conf.d</code> &gt; <code>conf.d</code></li>
|
||||
<li><code>snippets</code> &gt; <code>snippets</code></li>
|
||||
<li><code>custom_ssl</code> &gt; <code>custom_ssl</code> (if applicable)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit each file in your <code>sites-available</code> directory and update the paths. Most will change from <code>/data/nginx/</code> to <code>/etc/nginx</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit your <code>nginx.conf</code> file and ensure the following two paths are there:</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symlink the proxy host files in <code>sites-available</code> to <code>sites-enabled</code></p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Test your changes with <code>nginx -t</code>. Make appropriate changes if there are error messages.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h3 id="pre-requisites--assumptions">Pre-requisites &amp; Assumptions</h3>
|
||||
<p>I am using an Ubuntu VM with NPM and it&rsquo;s db as a Docker Container while Nginx is installed natively on the machine. You don&rsquo;t have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.</p>
|
||||
<p>I&rsquo;ve added some example files to show before and after changes to this repo and outlined file trees below.</p>
|
||||
<ul>
|
||||
<li>You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).</li>
|
||||
<li>You&rsquo;ve installed <a href="https://nginxproxymanager.com/setup/">NPM</a> and <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">Nginx</a> using your preferred method.</li>
|
||||
<li>You have access to both NPMs file tree and Nginx&rsquo;s.</li>
|
||||
<li>If using NPM in docker, make sure you&rsquo;ve mapped a local volume on the host to the container.</li>
|
||||
<li>My setup using docker-compose is the following: <code>/user/nginx/data:/data</code>.</li>
|
||||
<li>Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.</li>
|
||||
<li>For a linux install, they should be accessible at <code>/etc/nginx</code>.</li>
|
||||
<li>You know how to edit files at the command line using <code>nano</code>, <code>vi</code>, <code>vim</code>, <code>neovim</code>, <code>emacs</code>, or something else.</li>
|
||||
</ul>
|
||||
<h3 id="nginx-files">Nginx Files</h3>
|
||||
<p>Nginx uses the <code>nginx.conf</code> file and within that file, it will include your proxy files. These exist under <code>./nginx/sites-enabled/</code>. In the main <code>nginx.conf</code> file, the line <code>include /etc/nginx/sites-enabled/*;</code> will bring in those files to the config file, making the proxies accessible.</p>
|
||||
<h3 id="how-to-transition---detailed-version">How to Transition - Detailed Version</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.</p>
|
||||
<ul>
|
||||
<li>Docker: <code>docker stop [app_container, db_container]</code></li>
|
||||
<li>Systemd: <code>systemctl stop nginx</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>proxy_host</code> (NPM) files to the <code>sites-available</code> (Nginx) folder.
|
||||
<code>cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Nginx doesn&rsquo;t really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>custom_ssl</code> folder from NPM to the <code>custom_ssl</code> folder in Nginx. See the following step for the various default paths in both systems.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy the <code>conf.d</code> folder from NPM to the <code>conf.d</code> folder in Nginx. <em>Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my <code>conf.d</code> directory. If you&rsquo;re missing any files, please download and/or copy and
|
||||
paste them from the <a href="https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include">NPM Repo</a></em></p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/conf.d /etc/nginx/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the <code>snippets</code> directory.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I&rsquo;ve placed additional comments in <a href="./proxy_host/npm_proxy.conf"><code>./proxy_host/npm_proxy.conf</code></a> file. The line changes are the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Custom SSL path:</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/custom_ssl...</code></li>
|
||||
<li>Nginx path: <code>/etc/nginx/custom_ssl...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>conf.d:</p>
|
||||
<ul>
|
||||
<li>The paths should remain the same. However, if you changed the path for <code>conf.d</code> in Nginx and differed in step 5, above, make sure you use the correct path.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Access &amp; Error Logs</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/logs/...</code></li>
|
||||
<li>Nginx path: <code>/var/log/nginx/...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p>Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Navigate to the <code>nginx.conf</code> file which is located at <code>/etc/nginx/</code>. You can see the one I am using in this repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>You&rsquo;ll notice that you ensured there was a <code>sites-enabled</code> directory in the configuration file, but you changed all your proxy host config files in <code>sites-available</code>! Good eye, all that&rsquo;s left is to symlink the files to <code>sites-enabled</code> so that nginx can start using them.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>To symlink the available proxy files run the following command within the <code>sites-available</code> directory:</p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once you&rsquo;re confident that you&rsquo;ve done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your <code>nginx.conf</code> file - usually <code>/etc/nginx</code> - run the following command: <code>nginx -t</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there&rsquo;s a high likelihood that it will be path error.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
</span></span><span style="display:flex;"><span>nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
</span></span></code></pre></div><p>And that&rsquo;s it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system&rsquo;s status should nginx fail to start.</p>
|
||||
<h3 id="additional-informationappendix">Additional Information/Appendix</h3>
|
||||
<h4 id="file-trees-for-npm-in-container-and-nginx-on-host">File Trees for NPM (in container) and Nginx (on host)</h4>
|
||||
<p><em>I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.</em></p>
|
||||
<h4 id="nginx">NGINX</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── conf.d
|
||||
</span></span><span style="display:flex;"><span>│ └── include
|
||||
</span></span><span style="display:flex;"><span>│ ├── assets.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── block-exploits.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── force-ssl.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── ip_ranges.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── resolvers.conf
|
||||
</span></span><span style="display:flex;"><span>├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi.conf
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi_params
|
||||
</span></span><span style="display:flex;"><span>├── koi-utf
|
||||
</span></span><span style="display:flex;"><span>├── koi-win
|
||||
</span></span><span style="display:flex;"><span>├── mime.types
|
||||
</span></span><span style="display:flex;"><span>├── modules-available
|
||||
</span></span><span style="display:flex;"><span>├── modules-enabled
|
||||
</span></span><span style="display:flex;"><span>├── nginx.conf
|
||||
</span></span><span style="display:flex;"><span>├── proxy_params
|
||||
</span></span><span style="display:flex;"><span>├── scgi_params
|
||||
</span></span><span style="display:flex;"><span>├── sites-available
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── default.backup
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── rsmsn-root.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── sites-enabled
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf -&gt; /etc/nginx/sites-available/auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf -&gt; /etc/nginx/sites-available/bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf -&gt; /etc/nginx/sites-available/codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf -&gt; /etc/nginx/sites-available/files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf -&gt; /etc/nginx/sites-available/notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf -&gt; /etc/nginx/sites-available/photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf -&gt; /etc/nginx/sites-available/wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf -&gt; /etc/nginx/sites-available/wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── fastcgi-php.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── snakeoil.conf
|
||||
</span></span><span style="display:flex;"><span>├── uwsgi_params
|
||||
</span></span><span style="display:flex;"><span>└── win-utf
|
||||
</span></span></code></pre></div><h4 id="npm">NPM</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── data
|
||||
</span></span><span style="display:flex;"><span>│ ├── access
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── keys.json
|
||||
</span></span><span style="display:flex;"><span>│ ├── letsencrypt-acme-challenge
|
||||
</span></span><span style="display:flex;"><span>│ ├── logs
|
||||
</span></span><span style="display:flex;"><span>│ ├── mysql
|
||||
</span></span><span style="display:flex;"><span>│ └── nginx
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom
|
||||
</span></span><span style="display:flex;"><span>│ ├── dead_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_www
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummycert.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummykey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy_host
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 10.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 11.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 12.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 13.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 15.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 1.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 2.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 4.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 5.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── 6.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── redirection_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── stream
|
||||
</span></span><span style="display:flex;"><span>│ └── temp
|
||||
</span></span><span style="display:flex;"><span>├── docker-compose.yml
|
||||
</span></span><span style="display:flex;"><span>└── letsencrypt
|
||||
</span></span><span style="display:flex;"><span>└── renewal-hooks
|
||||
</span></span></code></pre></div></content>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
418
public/posts/npm_to_nginx_tutorial/index.html
Normal file
418
public/posts/npm_to_nginx_tutorial/index.html
Normal file
@ -0,0 +1,418 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>Tutorial: Move from NginxProxyManager to Nginx :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition." />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="Tutorial: Move from NginxProxyManager to Nginx">
|
||||
<meta property="og:description" content="A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition." />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
<meta property="article:published_time" content="2023-08-05 15:23:51 -0500 -0500" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<article class="post">
|
||||
<h1 class="post-title">
|
||||
<a href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/">Tutorial: Move from NginxProxyManager to Nginx</a>
|
||||
</h1>
|
||||
<div class="post-meta"><time class="post-date">2023-08-05</time></div>
|
||||
|
||||
|
||||
<span class="post-tags">
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial</a>
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted</a>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-content"><div>
|
||||
<p>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for <a href="https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/">this reddit
|
||||
post</a> and to post this <a href="https://github.com/Normanras/Npm_to_Nginx">my Github profile</a>. Thought my website would also be a good place to share it for any passers-by.</p>
|
||||
<h2 id="goal">Goal<a href="#goal" class="hanchor" ariaLabel="Anchor">⌗</a> </h2>
|
||||
<p>To give clear instructions to help users migrate from using <a href="https://nginxproxymanager.com/">Nginx Proxy Manager</a> (NPM) to standard <a href="https://docs.nginx.com/">Nginx</a>. This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx <a href="http://nginx.org/en/docs/">Documentation Sites</a> and tutorials to learn more.</p>
|
||||
<h3 id="introduction">Introduction<a href="#introduction" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<p>If you’re anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you’ve likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you’ve also been paying attention to various self-hosted communities, you may have also come across Christian Lempa’s Video on <a href="https://youtu.be/uaixCKTaqY0">trusting smaller self hosted projects and tools</a>.</p>
|
||||
<p><em>Spoilers:</em> He roasts NPM in his video and towards the end says he won’t be using NPM anymore. He also, perhaps purposely, doesn’t share which tool he will be migrating to.</p>
|
||||
<p>Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn’t taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.</p>
|
||||
<p><em>Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you’d like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.</em></p>
|
||||
<h3 id="tldr---quick-steps">TL;DR - Quick Steps<a href="#tldr---quick-steps" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Copy the following contents (including sub-directories) from the NPM <code>/data/nginx</code> directory to the Nginx <code>/etc/nginx</code> folder:</p>
|
||||
<ul>
|
||||
<li><code>proxy_hosts</code> > <code>sites-available</code></li>
|
||||
<li><code>conf.d</code> > <code>conf.d</code></li>
|
||||
<li><code>snippets</code> > <code>snippets</code></li>
|
||||
<li><code>custom_ssl</code> > <code>custom_ssl</code> (if applicable)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit each file in your <code>sites-available</code> directory and update the paths. Most will change from <code>/data/nginx/</code> to <code>/etc/nginx</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit your <code>nginx.conf</code> file and ensure the following two paths are there:</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symlink the proxy host files in <code>sites-available</code> to <code>sites-enabled</code></p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Test your changes with <code>nginx -t</code>. Make appropriate changes if there are error messages.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h3 id="pre-requisites--assumptions">Pre-requisites & Assumptions<a href="#pre-requisites--assumptions" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<p>I am using an Ubuntu VM with NPM and it’s db as a Docker Container while Nginx is installed natively on the machine. You don’t have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.</p>
|
||||
<p>I’ve added some example files to show before and after changes to this repo and outlined file trees below.</p>
|
||||
<ul>
|
||||
<li>You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).</li>
|
||||
<li>You’ve installed <a href="https://nginxproxymanager.com/setup/">NPM</a> and <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">Nginx</a> using your preferred method.</li>
|
||||
<li>You have access to both NPMs file tree and Nginx’s.</li>
|
||||
<li>If using NPM in docker, make sure you’ve mapped a local volume on the host to the container.</li>
|
||||
<li>My setup using docker-compose is the following: <code>/user/nginx/data:/data</code>.</li>
|
||||
<li>Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.</li>
|
||||
<li>For a linux install, they should be accessible at <code>/etc/nginx</code>.</li>
|
||||
<li>You know how to edit files at the command line using <code>nano</code>, <code>vi</code>, <code>vim</code>, <code>neovim</code>, <code>emacs</code>, or something else.</li>
|
||||
</ul>
|
||||
<h3 id="nginx-files">Nginx Files<a href="#nginx-files" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<p>Nginx uses the <code>nginx.conf</code> file and within that file, it will include your proxy files. These exist under <code>./nginx/sites-enabled/</code>. In the main <code>nginx.conf</code> file, the line <code>include /etc/nginx/sites-enabled/*;</code> will bring in those files to the config file, making the proxies accessible.</p>
|
||||
<h3 id="how-to-transition---detailed-version">How to Transition - Detailed Version<a href="#how-to-transition---detailed-version" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.</p>
|
||||
<ul>
|
||||
<li>Docker: <code>docker stop [app_container, db_container]</code></li>
|
||||
<li>Systemd: <code>systemctl stop nginx</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>proxy_host</code> (NPM) files to the <code>sites-available</code> (Nginx) folder.
|
||||
<code>cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Nginx doesn’t really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>custom_ssl</code> folder from NPM to the <code>custom_ssl</code> folder in Nginx. See the following step for the various default paths in both systems.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy the <code>conf.d</code> folder from NPM to the <code>conf.d</code> folder in Nginx. <em>Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my <code>conf.d</code> directory. If you’re missing any files, please download and/or copy and
|
||||
paste them from the <a href="https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include">NPM Repo</a></em></p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/conf.d /etc/nginx/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the <code>snippets</code> directory.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I’ve placed additional comments in <a href="./proxy_host/npm_proxy.conf"><code>./proxy_host/npm_proxy.conf</code></a> file. The line changes are the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Custom SSL path:</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/custom_ssl...</code></li>
|
||||
<li>Nginx path: <code>/etc/nginx/custom_ssl...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>conf.d:</p>
|
||||
<ul>
|
||||
<li>The paths should remain the same. However, if you changed the path for <code>conf.d</code> in Nginx and differed in step 5, above, make sure you use the correct path.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Access & Error Logs</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/logs/...</code></li>
|
||||
<li>Nginx path: <code>/var/log/nginx/...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p>Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Navigate to the <code>nginx.conf</code> file which is located at <code>/etc/nginx/</code>. You can see the one I am using in this repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>You’ll notice that you ensured there was a <code>sites-enabled</code> directory in the configuration file, but you changed all your proxy host config files in <code>sites-available</code>! Good eye, all that’s left is to symlink the files to <code>sites-enabled</code> so that nginx can start using them.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>To symlink the available proxy files run the following command within the <code>sites-available</code> directory:</p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once you’re confident that you’ve done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your <code>nginx.conf</code> file - usually <code>/etc/nginx</code> - run the following command: <code>nginx -t</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there’s a high likelihood that it will be path error.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
</span></span><span style="display:flex;"><span>nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
</span></span></code></pre></div><p>And that’s it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system’s status should nginx fail to start.</p>
|
||||
<h3 id="additional-informationappendix">Additional Information/Appendix<a href="#additional-informationappendix" class="hanchor" ariaLabel="Anchor">⌗</a> </h3>
|
||||
<h4 id="file-trees-for-npm-in-container-and-nginx-on-host">File Trees for NPM (in container) and Nginx (on host)<a href="#file-trees-for-npm-in-container-and-nginx-on-host" class="hanchor" ariaLabel="Anchor">⌗</a> </h4>
|
||||
<p><em>I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.</em></p>
|
||||
<h4 id="nginx">NGINX<a href="#nginx" class="hanchor" ariaLabel="Anchor">⌗</a> </h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── conf.d
|
||||
</span></span><span style="display:flex;"><span>│ └── include
|
||||
</span></span><span style="display:flex;"><span>│ ├── assets.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── block-exploits.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── force-ssl.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── ip_ranges.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── resolvers.conf
|
||||
</span></span><span style="display:flex;"><span>├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi.conf
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi_params
|
||||
</span></span><span style="display:flex;"><span>├── koi-utf
|
||||
</span></span><span style="display:flex;"><span>├── koi-win
|
||||
</span></span><span style="display:flex;"><span>├── mime.types
|
||||
</span></span><span style="display:flex;"><span>├── modules-available
|
||||
</span></span><span style="display:flex;"><span>├── modules-enabled
|
||||
</span></span><span style="display:flex;"><span>├── nginx.conf
|
||||
</span></span><span style="display:flex;"><span>├── proxy_params
|
||||
</span></span><span style="display:flex;"><span>├── scgi_params
|
||||
</span></span><span style="display:flex;"><span>├── sites-available
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── default.backup
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── rsmsn-root.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── sites-enabled
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf -> /etc/nginx/sites-available/auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf -> /etc/nginx/sites-available/bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf -> /etc/nginx/sites-available/codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf -> /etc/nginx/sites-available/files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf -> /etc/nginx/sites-available/notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf -> /etc/nginx/sites-available/photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf -> /etc/nginx/sites-available/wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf -> /etc/nginx/sites-available/wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── fastcgi-php.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── snakeoil.conf
|
||||
</span></span><span style="display:flex;"><span>├── uwsgi_params
|
||||
</span></span><span style="display:flex;"><span>└── win-utf
|
||||
</span></span></code></pre></div><h4 id="npm">NPM<a href="#npm" class="hanchor" ariaLabel="Anchor">⌗</a> </h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── data
|
||||
</span></span><span style="display:flex;"><span>│ ├── access
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── keys.json
|
||||
</span></span><span style="display:flex;"><span>│ ├── letsencrypt-acme-challenge
|
||||
</span></span><span style="display:flex;"><span>│ ├── logs
|
||||
</span></span><span style="display:flex;"><span>│ ├── mysql
|
||||
</span></span><span style="display:flex;"><span>│ └── nginx
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom
|
||||
</span></span><span style="display:flex;"><span>│ ├── dead_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_www
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummycert.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummykey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy_host
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 10.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 11.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 12.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 13.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 15.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 1.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 2.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 4.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 5.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── 6.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── redirection_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── stream
|
||||
</span></span><span style="display:flex;"><span>│ └── temp
|
||||
</span></span><span style="display:flex;"><span>├── docker-compose.yml
|
||||
</span></span><span style="display:flex;"><span>└── letsencrypt
|
||||
</span></span><span style="display:flex;"><span>└── renewal-hooks
|
||||
</span></span></code></pre></div>
|
||||
</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
public/posts/page/1/index.html
Normal file
10
public/posts/page/1/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>https://selfhosted.rsmsn.co/posts/</title>
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/posts/">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://selfhosted.rsmsn.co/posts/">
|
||||
</head>
|
||||
</html>
|
||||
25
public/sitemap.xml
Normal file
25
public/sitemap.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<url>
|
||||
<loc>https://selfhosted.rsmsn.co/posts/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/tags/self-hosted/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/tags/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/tags/tutorial/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</loc>
|
||||
<lastmod>2023-08-05T15:23:51-05:00</lastmod>
|
||||
</url><url>
|
||||
<loc>https://selfhosted.rsmsn.co/categories/</loc>
|
||||
</url>
|
||||
</urlset>
|
||||
3
public/styles.css
Normal file
3
public/styles.css
Normal file
File diff suppressed because one or more lines are too long
45
public/styles.css.map
Normal file
45
public/styles.css.map
Normal file
File diff suppressed because one or more lines are too long
150
public/tags/index.html
Normal file
150
public/tags/index.html
Normal file
@ -0,0 +1,150 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>Tags :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/tags/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Tags">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/tags/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="../tags/index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="terms">
|
||||
<h1>Tags</h1>
|
||||
|
||||
<ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a class="terms-title" href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted [1]</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a class="terms-title" href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial [1]</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
31
public/tags/index.xml
Normal file
31
public/tags/index.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Tags on Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/tags/</link>
|
||||
<description>Recent content in Tags on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Sat, 05 Aug 2023 15:23:51 -0500</lastBuildDate><atom:link href="https://selfhosted.rsmsn.co/tags/index.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>self-hosted</title>
|
||||
<link>https://selfhosted.rsmsn.co/tags/self-hosted/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/tags/self-hosted/</guid>
|
||||
<description></description>
|
||||
<content></content>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>tutorial</title>
|
||||
<link>https://selfhosted.rsmsn.co/tags/tutorial/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/tags/tutorial/</guid>
|
||||
<description></description>
|
||||
<content></content>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
172
public/tags/self-hosted/index.html
Normal file
172
public/tags/self-hosted/index.html
Normal file
@ -0,0 +1,172 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>self-hosted :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/tags/self-hosted/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="self-hosted">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/tags/self-hosted/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="../../tags/self-hosted/index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<h1>Posts for: #self-hosted</h1>
|
||||
|
||||
<div class="posts">
|
||||
|
||||
<article class="post on-list">
|
||||
<h1 class="post-title">
|
||||
<a href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/">Tutorial: Move from NginxProxyManager to Nginx</a>
|
||||
</h1>
|
||||
<div class="post-meta"><time class="post-date">2023-08-05</time></div>
|
||||
|
||||
|
||||
<span class="post-tags">
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial</a>
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted</a>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<a class="read-more button" href="../../posts/npm_to_nginx_tutorial/"> →</a>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination__buttons">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
281
public/tags/self-hosted/index.xml
Normal file
281
public/tags/self-hosted/index.xml
Normal file
@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>self-hosted on Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/tags/self-hosted/</link>
|
||||
<description>Recent content in self-hosted on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Sat, 05 Aug 2023 15:23:51 -0500</lastBuildDate><atom:link href="https://selfhosted.rsmsn.co/tags/self-hosted/index.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>Tutorial: Move from NginxProxyManager to Nginx</title>
|
||||
<link>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</guid>
|
||||
<description>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.</description>
|
||||
<content><p>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for <a href="https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/">this reddit
|
||||
post</a> and to post this <a href="https://github.com/Normanras/Npm_to_Nginx">my Github profile</a>. Thought my website would also be a good place to share it for any passers-by.</p>
|
||||
<h2 id="goal">Goal</h2>
|
||||
<p>To give clear instructions to help users migrate from using <a href="https://nginxproxymanager.com/">Nginx Proxy Manager</a> (NPM) to standard <a href="https://docs.nginx.com/">Nginx</a>. This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx <a href="http://nginx.org/en/docs/">Documentation Sites</a> and tutorials to learn more.</p>
|
||||
<h3 id="introduction">Introduction</h3>
|
||||
<p>If you&rsquo;re anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you&rsquo;ve likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you&rsquo;ve also been paying attention to various self-hosted communities, you may have also come across Christian Lempa&rsquo;s Video on <a href="https://youtu.be/uaixCKTaqY0">trusting smaller self hosted projects and tools</a>.</p>
|
||||
<p><em>Spoilers:</em> He roasts NPM in his video and towards the end says he won&rsquo;t be using NPM anymore. He also, perhaps purposely, doesn&rsquo;t share which tool he will be migrating to.</p>
|
||||
<p>Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn&rsquo;t taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.</p>
|
||||
<p><em>Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you&rsquo;d like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.</em></p>
|
||||
<h3 id="tldr---quick-steps">TL;DR - Quick Steps</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Copy the following contents (including sub-directories) from the NPM <code>/data/nginx</code> directory to the Nginx <code>/etc/nginx</code> folder:</p>
|
||||
<ul>
|
||||
<li><code>proxy_hosts</code> &gt; <code>sites-available</code></li>
|
||||
<li><code>conf.d</code> &gt; <code>conf.d</code></li>
|
||||
<li><code>snippets</code> &gt; <code>snippets</code></li>
|
||||
<li><code>custom_ssl</code> &gt; <code>custom_ssl</code> (if applicable)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit each file in your <code>sites-available</code> directory and update the paths. Most will change from <code>/data/nginx/</code> to <code>/etc/nginx</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit your <code>nginx.conf</code> file and ensure the following two paths are there:</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symlink the proxy host files in <code>sites-available</code> to <code>sites-enabled</code></p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Test your changes with <code>nginx -t</code>. Make appropriate changes if there are error messages.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h3 id="pre-requisites--assumptions">Pre-requisites &amp; Assumptions</h3>
|
||||
<p>I am using an Ubuntu VM with NPM and it&rsquo;s db as a Docker Container while Nginx is installed natively on the machine. You don&rsquo;t have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.</p>
|
||||
<p>I&rsquo;ve added some example files to show before and after changes to this repo and outlined file trees below.</p>
|
||||
<ul>
|
||||
<li>You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).</li>
|
||||
<li>You&rsquo;ve installed <a href="https://nginxproxymanager.com/setup/">NPM</a> and <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">Nginx</a> using your preferred method.</li>
|
||||
<li>You have access to both NPMs file tree and Nginx&rsquo;s.</li>
|
||||
<li>If using NPM in docker, make sure you&rsquo;ve mapped a local volume on the host to the container.</li>
|
||||
<li>My setup using docker-compose is the following: <code>/user/nginx/data:/data</code>.</li>
|
||||
<li>Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.</li>
|
||||
<li>For a linux install, they should be accessible at <code>/etc/nginx</code>.</li>
|
||||
<li>You know how to edit files at the command line using <code>nano</code>, <code>vi</code>, <code>vim</code>, <code>neovim</code>, <code>emacs</code>, or something else.</li>
|
||||
</ul>
|
||||
<h3 id="nginx-files">Nginx Files</h3>
|
||||
<p>Nginx uses the <code>nginx.conf</code> file and within that file, it will include your proxy files. These exist under <code>./nginx/sites-enabled/</code>. In the main <code>nginx.conf</code> file, the line <code>include /etc/nginx/sites-enabled/*;</code> will bring in those files to the config file, making the proxies accessible.</p>
|
||||
<h3 id="how-to-transition---detailed-version">How to Transition - Detailed Version</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.</p>
|
||||
<ul>
|
||||
<li>Docker: <code>docker stop [app_container, db_container]</code></li>
|
||||
<li>Systemd: <code>systemctl stop nginx</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>proxy_host</code> (NPM) files to the <code>sites-available</code> (Nginx) folder.
|
||||
<code>cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Nginx doesn&rsquo;t really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>custom_ssl</code> folder from NPM to the <code>custom_ssl</code> folder in Nginx. See the following step for the various default paths in both systems.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy the <code>conf.d</code> folder from NPM to the <code>conf.d</code> folder in Nginx. <em>Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my <code>conf.d</code> directory. If you&rsquo;re missing any files, please download and/or copy and
|
||||
paste them from the <a href="https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include">NPM Repo</a></em></p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/conf.d /etc/nginx/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the <code>snippets</code> directory.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I&rsquo;ve placed additional comments in <a href="./proxy_host/npm_proxy.conf"><code>./proxy_host/npm_proxy.conf</code></a> file. The line changes are the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Custom SSL path:</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/custom_ssl...</code></li>
|
||||
<li>Nginx path: <code>/etc/nginx/custom_ssl...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>conf.d:</p>
|
||||
<ul>
|
||||
<li>The paths should remain the same. However, if you changed the path for <code>conf.d</code> in Nginx and differed in step 5, above, make sure you use the correct path.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Access &amp; Error Logs</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/logs/...</code></li>
|
||||
<li>Nginx path: <code>/var/log/nginx/...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p>Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Navigate to the <code>nginx.conf</code> file which is located at <code>/etc/nginx/</code>. You can see the one I am using in this repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>You&rsquo;ll notice that you ensured there was a <code>sites-enabled</code> directory in the configuration file, but you changed all your proxy host config files in <code>sites-available</code>! Good eye, all that&rsquo;s left is to symlink the files to <code>sites-enabled</code> so that nginx can start using them.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>To symlink the available proxy files run the following command within the <code>sites-available</code> directory:</p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once you&rsquo;re confident that you&rsquo;ve done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your <code>nginx.conf</code> file - usually <code>/etc/nginx</code> - run the following command: <code>nginx -t</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there&rsquo;s a high likelihood that it will be path error.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
</span></span><span style="display:flex;"><span>nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
</span></span></code></pre></div><p>And that&rsquo;s it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system&rsquo;s status should nginx fail to start.</p>
|
||||
<h3 id="additional-informationappendix">Additional Information/Appendix</h3>
|
||||
<h4 id="file-trees-for-npm-in-container-and-nginx-on-host">File Trees for NPM (in container) and Nginx (on host)</h4>
|
||||
<p><em>I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.</em></p>
|
||||
<h4 id="nginx">NGINX</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── conf.d
|
||||
</span></span><span style="display:flex;"><span>│ └── include
|
||||
</span></span><span style="display:flex;"><span>│ ├── assets.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── block-exploits.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── force-ssl.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── ip_ranges.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── resolvers.conf
|
||||
</span></span><span style="display:flex;"><span>├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi.conf
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi_params
|
||||
</span></span><span style="display:flex;"><span>├── koi-utf
|
||||
</span></span><span style="display:flex;"><span>├── koi-win
|
||||
</span></span><span style="display:flex;"><span>├── mime.types
|
||||
</span></span><span style="display:flex;"><span>├── modules-available
|
||||
</span></span><span style="display:flex;"><span>├── modules-enabled
|
||||
</span></span><span style="display:flex;"><span>├── nginx.conf
|
||||
</span></span><span style="display:flex;"><span>├── proxy_params
|
||||
</span></span><span style="display:flex;"><span>├── scgi_params
|
||||
</span></span><span style="display:flex;"><span>├── sites-available
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── default.backup
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── rsmsn-root.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── sites-enabled
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf -&gt; /etc/nginx/sites-available/auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf -&gt; /etc/nginx/sites-available/bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf -&gt; /etc/nginx/sites-available/codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf -&gt; /etc/nginx/sites-available/files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf -&gt; /etc/nginx/sites-available/notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf -&gt; /etc/nginx/sites-available/photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf -&gt; /etc/nginx/sites-available/wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf -&gt; /etc/nginx/sites-available/wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── fastcgi-php.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── snakeoil.conf
|
||||
</span></span><span style="display:flex;"><span>├── uwsgi_params
|
||||
</span></span><span style="display:flex;"><span>└── win-utf
|
||||
</span></span></code></pre></div><h4 id="npm">NPM</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── data
|
||||
</span></span><span style="display:flex;"><span>│ ├── access
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── keys.json
|
||||
</span></span><span style="display:flex;"><span>│ ├── letsencrypt-acme-challenge
|
||||
</span></span><span style="display:flex;"><span>│ ├── logs
|
||||
</span></span><span style="display:flex;"><span>│ ├── mysql
|
||||
</span></span><span style="display:flex;"><span>│ └── nginx
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom
|
||||
</span></span><span style="display:flex;"><span>│ ├── dead_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_www
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummycert.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummykey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy_host
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 10.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 11.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 12.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 13.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 15.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 1.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 2.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 4.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 5.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── 6.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── redirection_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── stream
|
||||
</span></span><span style="display:flex;"><span>│ └── temp
|
||||
</span></span><span style="display:flex;"><span>├── docker-compose.yml
|
||||
</span></span><span style="display:flex;"><span>└── letsencrypt
|
||||
</span></span><span style="display:flex;"><span>└── renewal-hooks
|
||||
</span></span></code></pre></div></content>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
10
public/tags/self-hosted/page/1/index.html
Normal file
10
public/tags/self-hosted/page/1/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>https://selfhosted.rsmsn.co/tags/self-hosted/</title>
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/tags/self-hosted/">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://selfhosted.rsmsn.co/tags/self-hosted/">
|
||||
</head>
|
||||
</html>
|
||||
172
public/tags/tutorial/index.html
Normal file
172
public/tags/tutorial/index.html
Normal file
@ -0,0 +1,172 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<title>tutorial :: Rsmsn Blog</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="" />
|
||||
<meta name="keywords" content="" />
|
||||
|
||||
<meta name="robots" content="noodp" />
|
||||
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/tags/tutorial/" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://selfhosted.rsmsn.co/styles.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
<link rel="apple-touch-icon" href="https://selfhosted.rsmsn.co/img/theme-colors/orange.png">
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="en" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="tutorial">
|
||||
<meta property="og:description" content="" />
|
||||
<meta property="og:url" content="https://selfhosted.rsmsn.co/tags/tutorial/" />
|
||||
<meta property="og:site_name" content="Rsmsn Blog" />
|
||||
|
||||
|
||||
<meta property="og:image" content="img/favicon/%!s().png">
|
||||
|
||||
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="627">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="../../tags/tutorial/index.xml" rel="alternate" type="application/rss+xml" title="Rsmsn Blog" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
|
||||
<div class="container headings--one-size">
|
||||
|
||||
<header class="header">
|
||||
<div class="header__inner">
|
||||
<div class="header__logo">
|
||||
<a href="https://selfhosted.rsmsn.co/">
|
||||
<div class="logo">
|
||||
Terminal
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="content">
|
||||
|
||||
<h1>Posts for: #tutorial</h1>
|
||||
|
||||
<div class="posts">
|
||||
|
||||
<article class="post on-list">
|
||||
<h1 class="post-title">
|
||||
<a href="https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/">Tutorial: Move from NginxProxyManager to Nginx</a>
|
||||
</h1>
|
||||
<div class="post-meta"><time class="post-date">2023-08-05</time></div>
|
||||
|
||||
|
||||
<span class="post-tags">
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/tutorial/">tutorial</a>
|
||||
|
||||
#<a href="https://selfhosted.rsmsn.co/tags/self-hosted/">self-hosted</a>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<a class="read-more button" href="../../posts/npm_to_nginx_tutorial/"> →</a>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination__buttons">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer__inner">
|
||||
|
||||
<div class="copyright">
|
||||
<span>© 2023 Powered by <a href="https://gohugo.io">Hugo</a></span>
|
||||
|
||||
<span>:: <a href="https://github.com/panr/hugo-theme-terminal" target="_blank">Theme</a> made by <a href="https://github.com/panr" target="_blank">panr</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../bundle.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
281
public/tags/tutorial/index.xml
Normal file
281
public/tags/tutorial/index.xml
Normal file
@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>tutorial on Rsmsn Blog</title>
|
||||
<link>https://selfhosted.rsmsn.co/tags/tutorial/</link>
|
||||
<description>Recent content in tutorial on Rsmsn Blog</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<lastBuildDate>Sat, 05 Aug 2023 15:23:51 -0500</lastBuildDate><atom:link href="https://selfhosted.rsmsn.co/tags/tutorial/index.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>Tutorial: Move from NginxProxyManager to Nginx</title>
|
||||
<link>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</link>
|
||||
<pubDate>Sat, 05 Aug 2023 15:23:51 -0500</pubDate>
|
||||
|
||||
<guid>https://selfhosted.rsmsn.co/posts/npm_to_nginx_tutorial/</guid>
|
||||
<description>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for this reddit post and to post this my Github profile. Thought my website would also be a good place to share it for any passers-by.
|
||||
Goal To give clear instructions to help users migrate from using Nginx Proxy Manager (NPM) to standard Nginx. This tutorial is not exhaustive and there are many other implementations of this transition.</description>
|
||||
<content><p>A Tutorial Repo for migrating your Nginx Proxy Manager proxy setup to Nginx. I wrote this originally for <a href="https://www.reddit.com/r/selfhosted/comments/15j4v80/minitutorial_migrating_from_nginx_proxy_manager/">this reddit
|
||||
post</a> and to post this <a href="https://github.com/Normanras/Npm_to_Nginx">my Github profile</a>. Thought my website would also be a good place to share it for any passers-by.</p>
|
||||
<h2 id="goal">Goal</h2>
|
||||
<p>To give clear instructions to help users migrate from using <a href="https://nginxproxymanager.com/">Nginx Proxy Manager</a> (NPM) to standard <a href="https://docs.nginx.com/">Nginx</a>. This tutorial is not exhaustive and there are many other implementations of this transition. I would recommend checking out the many Nginx <a href="http://nginx.org/en/docs/">Documentation Sites</a> and tutorials to learn more.</p>
|
||||
<h3 id="introduction">Introduction</h3>
|
||||
<p>If you&rsquo;re anything like me and you got into the self-hosted/homelab/diy game sometime within the last 5 years, you&rsquo;ve likely been recommended to use Nginx Proxy Manager as one of the choice Reverse Proxy services. If you&rsquo;ve also been paying attention to various self-hosted communities, you may have also come across Christian Lempa&rsquo;s Video on <a href="https://youtu.be/uaixCKTaqY0">trusting smaller self hosted projects and tools</a>.</p>
|
||||
<p><em>Spoilers:</em> He roasts NPM in his video and towards the end says he won&rsquo;t be using NPM anymore. He also, perhaps purposely, doesn&rsquo;t share which tool he will be migrating to.</p>
|
||||
<p>Whether you follow Christian away from NPM or not, it dawned on me that while NPM is using a very trusted web server and reverse proxy under the hood, I hadn&rsquo;t taken the time to understand how an Nginx Config actually worked. Since NPM was already creating most of the files for Nginx, I got to reading through all the files and reworking them so that I could begin using Nginx without the NPM gui.</p>
|
||||
<p><em>Contributing: This is not all encompassing of Nginx possibilities. Including instructions for various installation methods, using OpenResty, and any other migrations or use cases would help the community. If you&rsquo;d like to add in additional information on how to migrate from NPM to Nginx, that is welcome. Simply submit a PR with your steps.</em></p>
|
||||
<h3 id="tldr---quick-steps">TL;DR - Quick Steps</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Copy the following contents (including sub-directories) from the NPM <code>/data/nginx</code> directory to the Nginx <code>/etc/nginx</code> folder:</p>
|
||||
<ul>
|
||||
<li><code>proxy_hosts</code> &gt; <code>sites-available</code></li>
|
||||
<li><code>conf.d</code> &gt; <code>conf.d</code></li>
|
||||
<li><code>snippets</code> &gt; <code>snippets</code></li>
|
||||
<li><code>custom_ssl</code> &gt; <code>custom_ssl</code> (if applicable)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit each file in your <code>sites-available</code> directory and update the paths. Most will change from <code>/data/nginx/</code> to <code>/etc/nginx</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Edit your <code>nginx.conf</code> file and ensure the following two paths are there:</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symlink the proxy host files in <code>sites-available</code> to <code>sites-enabled</code></p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Test your changes with <code>nginx -t</code>. Make appropriate changes if there are error messages.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<h3 id="pre-requisites--assumptions">Pre-requisites &amp; Assumptions</h3>
|
||||
<p>I am using an Ubuntu VM with NPM and it&rsquo;s db as a Docker Container while Nginx is installed natively on the machine. You don&rsquo;t have to use this setup exactly, but I am making a few assumptions as to what you should have access to before you begin. I am also using custom SSL certs, but theoretically, the transition should be the same when using Lets Encrypt.</p>
|
||||
<p>I&rsquo;ve added some example files to show before and after changes to this repo and outlined file trees below.</p>
|
||||
<ul>
|
||||
<li>You understand the basics of what a Reverse Proxy is doing and are sticking with some stock settings (like exposing port 80 an 443).</li>
|
||||
<li>You&rsquo;ve installed <a href="https://nginxproxymanager.com/setup/">NPM</a> and <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">Nginx</a> using your preferred method.</li>
|
||||
<li>You have access to both NPMs file tree and Nginx&rsquo;s.</li>
|
||||
<li>If using NPM in docker, make sure you&rsquo;ve mapped a local volume on the host to the container.</li>
|
||||
<li>My setup using docker-compose is the following: <code>/user/nginx/data:/data</code>.</li>
|
||||
<li>Know where your Nginx files are. If using docker, same as above, make sure your container directories are mapped to the host.</li>
|
||||
<li>For a linux install, they should be accessible at <code>/etc/nginx</code>.</li>
|
||||
<li>You know how to edit files at the command line using <code>nano</code>, <code>vi</code>, <code>vim</code>, <code>neovim</code>, <code>emacs</code>, or something else.</li>
|
||||
</ul>
|
||||
<h3 id="nginx-files">Nginx Files</h3>
|
||||
<p>Nginx uses the <code>nginx.conf</code> file and within that file, it will include your proxy files. These exist under <code>./nginx/sites-enabled/</code>. In the main <code>nginx.conf</code> file, the line <code>include /etc/nginx/sites-enabled/*;</code> will bring in those files to the config file, making the proxies accessible.</p>
|
||||
<h3 id="how-to-transition---detailed-version">How to Transition - Detailed Version</h3>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Since NPM uses Nginx under the hood, they are both, by default, going to try and use ports 80 and 443 to serve up your apps and content. Turn off both systems.</p>
|
||||
<ul>
|
||||
<li>Docker: <code>docker stop [app_container, db_container]</code></li>
|
||||
<li>Systemd: <code>systemctl stop nginx</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>proxy_host</code> (NPM) files to the <code>sites-available</code> (Nginx) folder.
|
||||
<code>cp -r /user/nginx/data/nginx/proxy_hosts/* /etc/nginx/sites-available/</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Nginx doesn&rsquo;t really care what the files are called, but NPM numbers them based on the order in which you added them in the GUI. I find it better to rename them to what service they actually serve up for easier identification later.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy your <code>custom_ssl</code> folder from NPM to the <code>custom_ssl</code> folder in Nginx. See the following step for the various default paths in both systems.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/custom_ssl/* /etc/nginx/custom_ssl/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Copy the <code>conf.d</code> folder from NPM to the <code>conf.d</code> folder in Nginx. <em>Note: For some reason, not all of the files in
|
||||
the proxy files were actually in my <code>conf.d</code> directory. If you&rsquo;re missing any files, please download and/or copy and
|
||||
paste them from the <a href="https://github.com/NginxProxyManager/nginx-proxy-manager/tree/fa851b61da3fe3726d1a04c25e69d36e79edea2d/docker/rootfs/etc/nginx/conf.d/include">NPM Repo</a></em></p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/conf.d /etc/nginx/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>If you had any additional files included in the Advanced section of an NPM Proxy Host, make sure you copy them over. For my setup and this tutorial, they were all located in the <code>snippets</code> directory.</p>
|
||||
<ul>
|
||||
<li><code>cp -r /user/nginx/data/nginx/snippets/* /etc/nginx/snippets/</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>There are a number of lines that need to be updated in each proxy configuration file to make them work with Nginx. I&rsquo;ve placed additional comments in <a href="./proxy_host/npm_proxy.conf"><code>./proxy_host/npm_proxy.conf</code></a> file. The line changes are the following:</p>
|
||||
<ol>
|
||||
<li>
|
||||
<p>Custom SSL path:</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/custom_ssl...</code></li>
|
||||
<li>Nginx path: <code>/etc/nginx/custom_ssl...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>conf.d:</p>
|
||||
<ul>
|
||||
<li>The paths should remain the same. However, if you changed the path for <code>conf.d</code> in Nginx and differed in step 5, above, make sure you use the correct path.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Access &amp; Error Logs</p>
|
||||
<ul>
|
||||
<li>NPM path: <code>/data/logs/...</code></li>
|
||||
<li>Nginx path: <code>/var/log/nginx/...</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>
|
||||
<p>Double Check all your paths! If this is your first time using Nginx, make sure every directory is correct! Save your work.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Navigate to the <code>nginx.conf</code> file which is located at <code>/etc/nginx/</code>. You can see the one I am using in this repo.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Make sure that you have the following two lines in the main conf file and that they are pointing to the appropriate directories in the nginx directory path.</p>
|
||||
<ul>
|
||||
<li><code>include /etc/nginx/conf.d/*.conf;</code> and <code>include /etc/nginx/sites-enabled/*;</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>You&rsquo;ll notice that you ensured there was a <code>sites-enabled</code> directory in the configuration file, but you changed all your proxy host config files in <code>sites-available</code>! Good eye, all that&rsquo;s left is to symlink the files to <code>sites-enabled</code> so that nginx can start using them.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>To symlink the available proxy files run the following command within the <code>sites-available</code> directory:</p>
|
||||
<ul>
|
||||
<li><code>ln -s * ./sites-enabled</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p>Once you&rsquo;re confident that you&rsquo;ve done all the above correctly, you can test your setup using nginx command and flags. While in the directory with your <code>nginx.conf</code> file - usually <code>/etc/nginx</code> - run the following command: <code>nginx -t</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If all is working as expected you should see the below output. If it returns any errors, fix them appropriately. It will usually tell you what line is throwing the error. In this case, there&rsquo;s a high likelihood that it will be path error.</p>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
||||
</span></span><span style="display:flex;"><span>nginx: configuration file /etc/nginx/nginx.conf test is successful
|
||||
</span></span></code></pre></div><p>And that&rsquo;s it! You can now restart your nginx service on the host and access all your sites just as if you were using Nginx Proxy Manager! Make sure you take a look at your logs and system&rsquo;s status should nginx fail to start.</p>
|
||||
<h3 id="additional-informationappendix">Additional Information/Appendix</h3>
|
||||
<h4 id="file-trees-for-npm-in-container-and-nginx-on-host">File Trees for NPM (in container) and Nginx (on host)</h4>
|
||||
<p><em>I did not expand every directory in these trees. Only the ones that are pertinent for reference in this tutorial.</em></p>
|
||||
<h4 id="nginx">NGINX</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── conf.d
|
||||
</span></span><span style="display:flex;"><span>│ └── include
|
||||
</span></span><span style="display:flex;"><span>│ ├── assets.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── block-exploits.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── force-ssl.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── ip_ranges.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── resolvers.conf
|
||||
</span></span><span style="display:flex;"><span>├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi.conf
|
||||
</span></span><span style="display:flex;"><span>├── fastcgi_params
|
||||
</span></span><span style="display:flex;"><span>├── koi-utf
|
||||
</span></span><span style="display:flex;"><span>├── koi-win
|
||||
</span></span><span style="display:flex;"><span>├── mime.types
|
||||
</span></span><span style="display:flex;"><span>├── modules-available
|
||||
</span></span><span style="display:flex;"><span>├── modules-enabled
|
||||
</span></span><span style="display:flex;"><span>├── nginx.conf
|
||||
</span></span><span style="display:flex;"><span>├── proxy_params
|
||||
</span></span><span style="display:flex;"><span>├── scgi_params
|
||||
</span></span><span style="display:flex;"><span>├── sites-available
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── default.backup
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── rsmsn-root.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── sites-enabled
|
||||
</span></span><span style="display:flex;"><span>│ ├── auth.conf -&gt; /etc/nginx/sites-available/auth.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── bitwarden.conf -&gt; /etc/nginx/sites-available/bitwarden.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── codehub.conf -&gt; /etc/nginx/sites-available/codehub.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── files.conf -&gt; /etc/nginx/sites-available/files.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── notes.conf -&gt; /etc/nginx/sites-available/notes.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── photos.conf -&gt; /etc/nginx/sites-available/photos.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── wordle.conf -&gt; /etc/nginx/sites-available/wordle.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── wordle-it.conf -&gt; /etc/nginx/sites-available/wordle-it.conf
|
||||
</span></span><span style="display:flex;"><span>├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── fastcgi-php.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ └── snakeoil.conf
|
||||
</span></span><span style="display:flex;"><span>├── uwsgi_params
|
||||
</span></span><span style="display:flex;"><span>└── win-utf
|
||||
</span></span></code></pre></div><h4 id="npm">NPM</h4>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>├── data
|
||||
</span></span><span style="display:flex;"><span>│ ├── access
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom_ssl
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-1
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── npm-2
|
||||
</span></span><span style="display:flex;"><span>│ │ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── npm-3
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── fullchain.pem
|
||||
</span></span><span style="display:flex;"><span>│ │ └── privkey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── keys.json
|
||||
</span></span><span style="display:flex;"><span>│ ├── letsencrypt-acme-challenge
|
||||
</span></span><span style="display:flex;"><span>│ ├── logs
|
||||
</span></span><span style="display:flex;"><span>│ ├── mysql
|
||||
</span></span><span style="display:flex;"><span>│ └── nginx
|
||||
</span></span><span style="display:flex;"><span>│ ├── custom
|
||||
</span></span><span style="display:flex;"><span>│ ├── dead_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── default_www
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummycert.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── dummykey.pem
|
||||
</span></span><span style="display:flex;"><span>│ ├── proxy_host
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 10.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 11.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 12.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 13.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 15.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 1.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 2.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 4.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── 5.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── 6.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── redirection_host
|
||||
</span></span><span style="display:flex;"><span>│ ├── snippets
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-authrequest-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-basic.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ ├── authelia-location-detect.conf
|
||||
</span></span><span style="display:flex;"><span>│ │ └── proxy.conf
|
||||
</span></span><span style="display:flex;"><span>│ ├── stream
|
||||
</span></span><span style="display:flex;"><span>│ └── temp
|
||||
</span></span><span style="display:flex;"><span>├── docker-compose.yml
|
||||
</span></span><span style="display:flex;"><span>└── letsencrypt
|
||||
</span></span><span style="display:flex;"><span>└── renewal-hooks
|
||||
</span></span></code></pre></div></content>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
10
public/tags/tutorial/page/1/index.html
Normal file
10
public/tags/tutorial/page/1/index.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>https://selfhosted.rsmsn.co/tags/tutorial/</title>
|
||||
<link rel="canonical" href="https://selfhosted.rsmsn.co/tags/tutorial/">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://selfhosted.rsmsn.co/tags/tutorial/">
|
||||
</head>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
{"Target":"styles.css","MediaType":"text/css","Data":{}}
|
||||
1
themes/terminal
Submodule
1
themes/terminal
Submodule
Submodule themes/terminal added at 7e13d24d10
Reference in New Issue
Block a user