|
1 | | -# Nginx proxy |
| 1 | +# nginx-proxy |
2 | 2 |
|
3 | | -This repo contains documentation about how to use the official [nginx-proxy docker image](https://hub.docker.com/r/jwilder/nginx-proxy) from jwilder to deploy any application on your linux server. It will automatically connect an arbitrary domain (e.g. blog.example.com) to the application and manage/renew ssl certificates. |
| 3 | +nginx-proxy is a combination of Open Source tools that enable you to easily deploy any (web) application that runs with Docker on your own linux server. Technically it is an automated nginx reverse proxy. The nginx-proxy will automatically detect your docker applications, will make them available under your specified domain such as `blog.example.com` and automatically requests and manages / renews Let’s Encrypt SSL certificates. |
4 | 4 |
|
5 | | -<br /> |
6 | | - |
7 | | -# Prerequisites |
8 | | - |
9 | | -1. Linux server / VPS |
10 | | -2. Docker and docker-compose installed on your server |
11 | | -3. Shell access with permissions to execute docker commands |
12 | | -4. Domain with access to the DNS settings |
13 | | - |
14 | | -If you don't have a linux server yet you can check out [netcup](https://www.netcup.de/vserver/vps.php) for a cheap and fast VPS. |
15 | | - |
16 | | -You can find more information about setting up the linux server in the `utils` folder. |
| 5 | +This nginx-proxy uses [Docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) and is based on the [jwilder/nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy) Docker image. |
17 | 6 |
|
18 | 7 | <br /> |
19 | 8 |
|
20 | | -# Step 1: Setup nginx proxy |
21 | | - |
22 | | -The nginx-proxy will automatically start when you start/restart your server. |
23 | | - |
24 | | -1. Copy `docker-compose.yml`, `proxy.conf`, `.env.example` and `.gitignore` to a destination of your liking on your linux server. |
25 | | -2. Create a docker network for nginx-proxy that allows the proxy to recognize the deployed containers. |
26 | | - |
27 | | - ``` |
28 | | - docker network create nginx-proxy |
29 | | - ``` |
30 | | - |
31 | | -3. Rename `.env.example` to `.env` and change the `LETSENCRYPT_EMAIL` value to your email. This mail will be used to send letsencrypt reminders for e.g. expiring certificates. |
32 | | -4. Start the nginx-proxy with: |
33 | | - |
34 | | - ``` |
35 | | - docker-compose up -d |
36 | | - ``` |
| 9 | +# [Documentation](https://nginxproxy.lars-rickert.de/) |
37 | 10 |
|
38 | 11 | <br /> |
39 | 12 |
|
40 | | -# Step 2 (optional): Deploy your first application |
41 | | - |
42 | | -Make sure to create an A Record in your domain DNS settings that points each domain you want to use with the nginx-proxy to the IP of your server. |
43 | | - |
44 | | -You can find examples for different applications in the `examples` folder. <br /> <br /> |
45 | | -There are `TODO: CHANGE ME` comments above all lines |
46 | | -of the example files that you need to change to make the example application your own. |
47 | | -You don't have to care about the other settings to get the application working but you might want to take a look at them for custom behavior. |
| 13 | +## Example use case |
48 | 14 |
|
49 | | -Important for any `docker-compose.yml` / application that you want to deploy: |
| 15 | +Imagine you just created a cool website or API that is now ready to be published to the world. While looking for a provider to deploy your application(s) you may find free providers like [Netlify](https://www.netlify.com/) or [Heroku](https://www.heroku.com/). |
50 | 16 |
|
51 | | -- Make sure to add: |
52 | | - |
53 | | - ``` |
54 | | - networks: |
55 | | - default: |
56 | | - name: nginx-proxy |
57 | | - external: true |
58 | | - ``` |
59 | | - |
60 | | - Otherwise the nginx-proxy will not be able to recognize your application and it will not be reachable through your domain. |
61 | | - |
62 | | -- Always add |
63 | | - |
64 | | - ``` |
65 | | - VIRTUAL_HOST: blog.example.com |
66 | | - LETSENCRYPT_HOST: blog.example.com |
67 | | - ``` |
68 | | - |
69 | | - to the environment variables of the `docker-compose.yml` (changing "blog.example.com" to the domain that you want to deploy the application to). Otherwise the application will not be reachable under the domain. |
70 | | - |
71 | | -<br /> |
72 | | - |
73 | | -# Further information |
74 | | - |
75 | | -- Read [nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy) for more information and configs. |
76 | | - |
77 | | -<br /> |
| 17 | +While they are great to deploy static content (e.g. plain HTML, CSS and JavaScript files) for free you will quickly recognize that e.g. server side applications are harder to deploy, cannot be deployed at all or you are not satisfied with the application speed. So you will have to look out for another provider for some of your applications. |
78 | 18 |
|
79 | | -# Known issues and fixes for nginx-proxy / applications |
| 19 | +On the other side there are paid Cloud providers like AWS, Google Cloud or Azure Cloud. But personally, we think they are not very beginner friendly (even for more experienced developers) and more expensive / overkill. |
80 | 20 |
|
81 | | -1. WordPress: Uploading large files to media library leads to unknown server error (status code 413) |
| 21 | +The goal of nginx-proxy is to have **ONE** easy, fast and cheap deployment solution for **ANY** application. This is where nginx-proxy comes into play. It will give you a self-hosted (and therefore performant) deployment solution with full-control. |
82 | 22 |
|
83 | | - - Problem: Default max. request body size of nginx proxy is too low |
84 | | - - Fix:. Change client_max_body_size in `proxy.conf` to your desired size and update the upload_max_filesize in the `uploads.ini` of your wordpress site. |
| 23 | +Once set up you will be able to deploy any Docker application in just a few minutes (or less) with automatically managed SSL certificates. |
0 commit comments