Giter Club home page Giter Club logo

Comments (7)

TrafeX avatar TrafeX commented on June 1, 2024 1

Hi Brennan,

Thanks for your input! I've done some changes that hopefully help you.
First I've changed the temporary/cache paths in Nginx to /tmp to resolve #16
Nginx recommends this for their own image as well; https://hub.docker.com/_/nginx

Secondly, I've added an Include /etc/nginx/conf.d/*.conf to nginx.conf that allows you to extend the config by mounting files in that folder.
For example; docker run -v "myconfig.conf:/etc/nginx/conf.d/myconfig.conf" ...

I've not broken down the config in separate files to keep it simple and easy to understand.
Let me know if this works for you!

from docker-php-nginx.

TrafeX avatar TrafeX commented on June 1, 2024 1

I'll close this issue. If you have any questions, let me know!

from docker-php-nginx.

polarathene avatar polarathene commented on June 1, 2024

Perhaps splitting the config like handled in this project would make sense? They have a very small server conf and include conf files for the rest.

It looks like you could just do the reverse, and include a conf file for the server root? Easy to override then.

from docker-php-nginx.

TrafeX avatar TrafeX commented on June 1, 2024

Hi Brennan,

Thank you for your suggestion! The original idea for this image was to make it an example how you can setup a container image with Nginx & PHP-FPM using some best practices and keep it as simple as possible. So I intentionally left out a 'modular config' setup to keep it straight forward and easy to understand for everyone. If you want to change something (and you probably need to) then you can fork it or copy it to your own setup.

But I see that more and more people are using this image as it is because it already covers some use cases. So I need to change this strategy a bit to still have it as an example but also making it a bit easier to extend while still being able to update when I push new changes.
I'm already working on that and will update this image soon.

For your case; indeed, changing the root in nginx.conf would be the way to go.

from docker-php-nginx.

TrafeX avatar TrafeX commented on June 1, 2024

I'll close this issue. If you have any questions, just re-open it!

from docker-php-nginx.

polarathene avatar polarathene commented on June 1, 2024

I'm not able to re-open the issue as I don't have permission. How do you feel with the earlier suggestion of breaking out some of the nginx.conf file into smaller conf files? You did state that you were working towards an update that might accommodate that?

For the issue in #16 I was able to just add an include ./adjustments/http.conf; into the nginx.conf http{} block, I placed it after the include mime.types; line and mounted the file from host to /etc/nginx/adjustments/http.conf. Nginx required all 5 paths to be adjusted to the /tmp location as shown in the linked issue(exact content of the file), then it would start successfully without permission errors on older kernels.


Would you like me to submit a PR that adds an include block for user additions in /etc/nginx/adjustments? And/or splitting the config for http and server blocks? Something like the earlier referenced project, which is pretty nice(except the fastgi.conf/mime.types files, those can be ignored, as they are included by default with nginx, I'm not sure why the project adds them).

from docker-php-nginx.

auchri avatar auchri commented on June 1, 2024

Hi, sorry for commenting on this old issue but I have a question:
How can I change the root-folder of nginx? I've already mounted a file (like -v "myconfig.conf:/etc/nginx/conf.d/myconfig.conf") but now my nginx fails to start because of the invalid configuration in there :D

from docker-php-nginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.