You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 11, 2025. It is now read-only.
| nginx latest version |`1.19.3`|`1.17.x` (last tested: `1.17.8`) |
56
+
| Alpine supported | ✅ | ✅ |
57
+
| Amazon supported | ✅ | ✅ |
58
+
| CentOS supported | ✅ | ✅ |
59
+
| Debian supported | ✅ | ✅ |
60
+
| Fedora supported | ✅ | ❌ |
61
+
| Ubuntu supported | ✅ | ✅ |
62
+
| Windows supported | ❌ | ✅ |
63
+
51
64
## Features
52
65
53
66
- Support for Lua.
@@ -62,35 +75,37 @@ Lua is a lightweight, high-level, multi-paradigm programming language designed p
62
75
63
76
## Typical Uses
64
77
65
-
Just to name a few:
66
-
67
-
* Mashup'ing and processing outputs of various Nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua,
68
-
* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends,
69
-
* manipulating response headers in an arbitrary way (by Lua)
70
-
* fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly,
71
-
* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage,
72
-
* doing very complex URL dispatch in Lua at rewrite phase,
73
-
* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations.
74
-
75
-
The possibilities are unlimited as the module allows bringing together various
76
-
elements within Nginx as well as exposing the power of the Lua language to the
77
-
user. The module provides the full flexibility of scripting while offering
78
-
performance levels comparable with native C language programs both in terms of
79
-
CPU time as well as memory footprint thanks to LuaJIT 2.x.
80
-
81
-
Other scripting language implementations typically struggle to match this
82
-
performance level.
78
+
> Just to name a few:
79
+
>
80
+
> * Mashup'ing and processing outputs of various Nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua,
81
+
> * doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends,
82
+
> * manipulating response headers in an arbitrary way (by Lua)
83
+
> * fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly,
84
+
> * coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other > storage,
85
+
> * doing very complex URL dispatch in Lua at rewrite phase,
86
+
> * using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations.
87
+
>
88
+
> The possibilities are unlimited as the module allows bringing together various
89
+
> elements within Nginx as well as exposing the power of the Lua language to the
90
+
> user. The module provides the full flexibility of scripting while offering
91
+
> performance levels comparable with native C language programs both in terms of
92
+
> CPU time as well as memory footprint thanks to LuaJIT 2.x.
93
+
>
94
+
> Other scripting language implementations typically struggle to match this
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
104
+
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d fabiocicerchia/nginx-lua
90
105
```
91
106
Alternatively, a simple `Dockerfile` can be used to generate a new image that includes the necessary content (which is a much cleaner solution than the bind mount above):
92
107
```dockerfile
93
-
FROM nginx
108
+
FROMfabiocicerchia/nginx-lua
94
109
COPY static-html-directory /usr/share/nginx/html
95
110
```
96
111
Place this file in the same directory as your directory of content ("static-html-directory"), run `docker build -t some-content-nginx .`, then start your container:
@@ -108,18 +123,18 @@ Then you can hit `http://localhost:8080` or `http://host-ip:8080` in your browse
108
123
### Complex configuration
109
124
110
125
```console
111
-
$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
126
+
$ docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d fabiocicerchia/nginx-lua
112
127
```
113
128
For information on the syntax of the nginx configuration files, see [the official documentation](http://nginx.org/en/docs/) (specifically the [Beginner's Guide](http://nginx.org/en/docs/beginners_guide.html#conf_structure)).
114
129
If you wish to adapt the default configuration, use something like the following to copy it from a running nginx container:
115
130
```console
116
-
$ docker run --name tmp-nginx-container -d nginx
131
+
$ docker run --name tmp-nginx-container -d fabiocicerchia/nginx-lua
This can also be accomplished more cleanly using a simple `Dockerfile` (in `/host/path/`):
121
136
```dockerfile
122
-
FROM nginx
137
+
FROMfabiocicerchia/nginx-lua
123
138
COPY nginx.conf /etc/nginx/nginx.conf
124
139
```
125
140
If you add a custom `CMD` in the Dockerfile, be sure to include `-g daemon off;` in the `CMD` in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!
@@ -133,7 +148,7 @@ Out-of-the-box, nginx doesn't support environment variables inside most configur
133
148
Here is an example using docker-compose.yml:
134
149
```yaml
135
150
web:
136
-
image: nginx
151
+
image: fabiocicerchia/nginx-lua
137
152
volumes:
138
153
- ./templates:/etc/nginx/templates
139
154
ports:
@@ -164,15 +179,15 @@ This behavior can be changed via the following environment variables:
164
179
165
180
To run nginx in read-only mode, you will need to mount a Docker volume to every location where nginx writes information. The default nginx configuration requires write access to `/var/cache` and `/var/run`. This can be easily accomplished by running nginx as follows:
If you have a more advanced configuration that requires nginx to write to other locations, simply add more volume mounts to those locations.
170
185
171
186
### Entrypoint quiet logs
172
187
173
188
Since version 1.19.0, a verbose entrypoint was added. It provides information on what's happening during container startup. You can silence this output by setting environment variable `NGINX_ENTRYPOINT_QUIET_LOGS`:
174
189
```console
175
-
$ docker run -d -e NGINX_ENTRYPOINT_QUIET_LOGS=1 nginx
190
+
$ docker run -d -e NGINX_ENTRYPOINT_QUIET_LOGS=1 fabiocicerchia/nginx-lua
176
191
```
177
192
178
193
### User and group id
@@ -375,6 +390,20 @@ $ docker build \
375
390
-f $DOCKERFILE .
376
391
```
377
392
393
+
## Custom Builds
394
+
395
+
If you need to extend the functionality of the existing image, you could build your own version using the following command.
396
+
For the list of values do refer to the [relative section](#compiled-version-details).
0 commit comments