Comments (11)
I just lost an hour trying to migrate from the official nginx image to openresty because of this.
I agree this should be done in openresty itself for good practice, but when talking about a docker image it's an absolute must.
With the 'include' as suggested by @duanzhanling above, the user can simply mount conf.d as a shared volume and manage his config without more hassle.
As of now, we need to overwrite the default config file inside the image to add that line manually (and it can't be a simple append because it has to be inside the braces). The only way I can think of to achieve this is to create a Dockerfile, then do some annoying manipulation of the default config file. On top of being more pain, it's also more brittle: changes in the default config might break aforementioned manipulation.
In short, this image doesn't have an extendable configuration.
from docker-openresty.
I have added a custom nginx config that includes /etc/nginx/conf.d/*.conf
in changeset 93c65ad
Enjoy!
from docker-openresty.
That file is supplied directly from the upstream OpenResty installation and I don't intend on modifying it. The current file is very basic and almost any use of OpenResty will require modification.
I see that the Nginx Docker images include the line you are suggesting. Maybe you are suggesting this change will just require end users to add files and not modify any?
from docker-openresty.
@ArnaudPel I think your line regarding mounting conf.d
is what I was looking for from the original reporter. This image isn't intended to be a drop-in replacement for nginx images but a base to build application servers. That said, I certainly want it to be easy to use and that use case makes sense.
I don't deploy like this, so I want to be complete... did you try adding this line to your own image?
include /usr/local/openresty/nginx/conf/conf.d/*.conf;
Was there anything else missing from the default nginx.conf
needed to get it going?
from docker-openresty.
Yes I think adding this line was enough to let me set my own configuration by using the following bind mount:
- /host/path/conf.d:/usr/local/openresty/nginx/conf/conf.d
Here the Dockerfile I put together to add the line, as you can see it's very brittle, and also quite annoying to have to build another image layer just for that. I'm no bash expert so there's probably a better way to do it.
FROM openresty/openresty:stretch
WORKDIR /usr/local/openresty
# The 'sed' will only work if the file ends with } then a new line (first part of the command), so it's very brittle
RUN echo "" >> nginx/conf/nginx.conf && \
sed -i 'x;${s/}$/ include \/usr\/local\/openresty\/nginx\/conf\/conf.d\/*.conf;\n}/;p;x;};1d' nginx/conf/nginx.conf
I should mention that in the end I won't be using openresty, what I wanted to achieve with Lua is simply too complicated for an nginx conf to handle. I have to use a fully-fledged app that allows me to run as many nested if/else
as I want.
from docker-openresty.
Reopening this... the changes are on the tree and work, but because of how the Docker Hub build system works, the nginx.conf
files are not being found.
I've been working on revamping the build system to use Google Cloud Builder (which will give a lot more flexibility with the builds) and should have that ready by the end of next weekend.
from docker-openresty.
The "master" images are now built on GCP and pushed to Docker Hub, see #62.
Thus the recent images at https://hub.docker.com/r/openresty/openresty/tags/ have the conf.d
feature.
from docker-openresty.
Can people who use this conf.d
feature please test it further and give me feedback?
If I get some confirmation, I will retag 1.13.6.1
to include it.
from docker-openresty.
@neomantra usedalpine-fat
to verify and it works fine
from docker-openresty.
@neomantra Works for me with the alpine-fat
tag. Can you retag the the 1.13.6.1
version?
from docker-openresty.
I've updated the tagging convention to include a <docker build>
number and have automated builds again using Travis CI (#62).
This feature is is now tagged as 1.13.6.1-<flavor>
as well as 1.13.6.1-1-<flavor>
.
The OpenResty 1.13.6.1 without this feature (for those who have conflicts with this setup, if any) is tagged at 1.13.6.1-0-<flavor>
.
from docker-openresty.
Related Issues (20)
- Point for command injection after openresty download before configure HOT 7
- Cannot able to install luaexpat on top of openresty-centos8 HOT 4
- modsecurity-crs-docker integration HOT 18
- Openresty cannot able to resolve DNS changes HOT 1
- 你的微信号多少,发我邮箱
- ngx_http_upstream_check_module无法添加模块 HOT 1
- fedora aarch64 builds failing HOT 1
- Add Debian 12 `bookworm` release HOT 7
- Upgrade OpenSSL to 1.1.1u HOT 3
- image for new release v1.21.4.2 HOT 7
- Upgrade to openssl 3.0 HOT 1
- HTTP2 Rapid Reset Mitigation HOT 3
- Can't load the cjson module into luajit CLI HOT 1
- Update debian and other images HOT 1
- Builds for Debian 11 and 12 are broken HOT 2
- Image for new release 1.25.3.1 HOT 3
- Adding Third Party Modules to Debian Images Utilizing the ".deb" Installation
- OpenSSL 1.1.1x for CVE-2023-5678 HOT 1
- environment variable injected by docker compose is not available in openresty process HOT 2
- RHEL support for openresty HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-openresty.