-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnpm-installation.html
92 lines (91 loc) · 4.71 KB
/
npm-installation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!--
title: How to use NPM
description: Here you'll learn how to use Nginx Proxy Manager
published: true
date: 2024-10-06T09:41:15.791Z
tags: server
editor: ckeditor
dateCreated: 2024-10-04T20:17:21.085Z
-->
<h1>How to use NGINX proxy manager</h1>
<p><strong>In this guide you'll learn how to install NPM on your machine! </strong>This deployment uses docker, so if you don't have it installed, please check out the guide on how to install it!</p>
<p>You should also know that this is just a different version of the official installation instructions situated <a href="https://nginxproxymanager.com/guide/">here</a>!</p>
<h2>1- What is a proxy, and what good is NPM for?</h2>
<p>A <strong>proxy</strong> acts as an intermediary between a client and a server, facilitating communication by forwarding requests and responses between them. There are two main types:</p>
<ul>
<li><strong>Forward Proxy</strong>: This type sits in front of the client and forwards requests to the server on behalf of the client. It's often used for privacy, security, or content filtering.</li>
<li><strong>Reverse Proxy</strong>: This sits in front of the server and forwards requests from clients to different servers. It's commonly used for load balancing, security, and caching.</li>
</ul>
<p><strong>Nginx Proxy Manager (NPM)</strong> is a convenient, web-based interface for managing reverse proxies with Nginx. It simplifies the process of configuring proxy servers by allowing users to manage:</p>
<ul>
<li><strong>SSL certificates</strong> for secure connections</li>
<li><strong>Load balancing</strong> to distribute traffic across multiple servers</li>
<li><strong>Access control</strong> and security rules</li>
<li><strong>Redirection and caching</strong> for efficient traffic management</li>
</ul>
<p>In essence, NPM provides a user-friendly way to implement reverse proxies, making it easier to manage web traffic and server resources while improving security and performance.</p>
<h2>2- What do I need to prepare in advance?</h2>
<ol>
<li>You'll need to have a server/machine running any software compatible with the latest docker and docker compose versions</li>
<li>Install docker on your server/machine</li>
<li>Install docker compose on your server/machine</li>
<li>The ports <strong>80</strong>, <strong>443</strong> and <strong>81</strong> need to be free on your machine</li>
<li>You must have a domain or subdomain pointing to your server with an <strong>A record </strong>and an optional <strong>AAAA record</strong>.</li>
</ol>
<h2>3- How to install NPM</h2>
<ol>
<li>First you'll need to create a folder to store the contents and compose file:</li>
</ol>
<pre><code class="language-plaintext">mkdir nginx-proxy
cd nginx-proxy</code></pre>
<p> </p>
<hr>
<p>2. Create the docker compose file in the directory:</p>
<pre><code class="language-plaintext">sudo nano docker-compose.yml</code></pre>
<p> </p>
<hr>
<p>3. Paste the contents below inside your file:</p>
<pre><code class="language-plaintext">version: '3.8'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt</code></pre>
<p> </p>
<hr>
<p>4. Save your file by pressing <strong>ctrl + x </strong>and when it prompts you to save press <strong>y </strong>and then the <strong>enter key</strong></p>
<hr>
<p>5. Run your compose file:</p>
<p>This will run your docker compose file, and launch your proxy with the specified ports</p>
<pre><code class="language-plaintext">sudo docker compose up -d</code></pre>
<p> </p>
<hr>
<p>6. Access the admin interface at <strong>[yourserverip]:81</strong></p>
<p>Log in using the default login data, and <strong>make sure to change the email and password after logging in for the first time!</strong></p>
<figure class="table">
<table>
<tbody>
<tr>
<td><strong>Email adress</strong></td>
<td>admin@example.com</td>
</tr>
<tr>
<td><strong>Password</strong></td>
<td>changeme</td>
</tr>
</tbody>
</table>
</figure>
<figure class="image"><img src="/screenshot_2024-10-05_091427.png">
<figcaption>This is what you should see after accessing the ip with the port I provided</figcaption>
</figure>
<hr>
<p>7. You're all set! Your proxy should now work correctly! In the next steps I will tell you how to use it!</p>
<h2>4- How to use NPM</h2>
<p>NPM will allow you to use <strong>subdomains </strong>pointing at <strong>different services with different ports on one single machine</strong>. It will also allow you to <strong>automatically generate and regenerate letsencrypt SSL certificates for any of your domains/subdomains</strong>.</p>