New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastcgi does not work #1466
Comments
This problem made me very curious and I found out why it's not working. Missing in the generated
Also missing something like See my test repo: https://github.com/flowl/so6292053
You will now see a |
When I do Perhaps you have an outdated version of the |
For context, the
|
@tkw1536 in the config is no |
Thanks! It works!! |
fastcgi not work with wordpress-fpm. |
Based on the example by @flowl I have implemented https://github.com/tkw1536/nginx-proxy-fpm-workaround. This solution |
My previously mentioned line of config with
@tkw1536 it should be taken care of where the files are coming from because The missing configuration should be dynamically build into the resulting files, anything fixed or hardcoded is against the idea of the dynamic reverse proxy imo. |
I have tried ! this only work then compile static file php. |
I confirm, I face the same issue, merci buchdag pour ton travail et si tu arrives à regler le fastcgi |
I'm not sure if this would be a solution, but if there was somehow a way to implement additional VIRTUAL_ variables in the services being proxied for a location.conf and static.conf so nginx would see these variables on a new container and add them to /vhost.d/. I'm basing this on @fowl / @tkw1536 fix. The issue is though this workaround is "working" we need a way to instead of defining the static and location conf in nginx-proxy container, instead define it in the service-being-proxied's container, so when a new container is "seen" by nginx-proxy it automagically adds location / static confs. Not sure if this is possible. How it's currently done via @tkw1536 workaround via volume mounts in nginx-proxy container:
Proposed workaround in the actual proxied service via environment variables:
fpm_workaround_location.conf / example.com_location.conf :
fpm_workaround_static.conf / example.com.conf :
Again, not sure if this is even possible, but it seems like it might be a fix if one of the devs could get it working.@buchdag |
Disclaimer : I'm not a user of php-fpm and not really familiar with it I'm having issues understanding if this "fpm-workaround" that keep being mentioned is something specific to nginx-proxy / some setup or something that has to be applied with nginx + php-fpm no matter what. Could someone point me to some doc regarding this ? |
and ... ... might help you. |
Could you re explain to me how those new php:
image: php:fpm
environment:
VIRTUAL_HOST: example.com
VIRTUAL_PROTO: fastcgi
VIRTUAL_PORT: 9000
VIRTUAL_ROOT: /var/www/html
# Proposed variables to add to nginx-proxy:
VIRTUAL_LOCATION_CONF: ./example.com_location.conf
VIRTUAL_STATIC_CONF: ./example.com_static.conf
volumes:
- ./html:/var/www/html Because either I did not get it, or the expected behaviour of those two new variables is already possible with two existing features, Per-VIRTUAL_HOST configuration for Those two features automatically add the directives contained in specially named files respectively to the This is why @tkw1536 is using |
@flowl I did not understand that part.
Isn't that what @tkw1536 proposed solution using per_VIRTUAL_HOST configuration and per-VIRTUAL_HOST location configuration does ? |
@buchdag @flowl @tkw1536 @SturmB After a few weeks of experimenting, reading articles, and searching for an answer on how to setup a multiple wordpress/fpm setup with nginx-proxy, I was finally able to come up with a setup that works. No hacks needed. I hope this helps! https://github.com/PeterTucker/multiple-docker-wp-fpm-nginx-proxy-setup |
@PeterTucker fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #new line and import him to conteiner: proxy:
image: 'jwilder/nginx-proxy'
container_name: 'reverse-proxy'
ports:
- '${PORT}:80'
volumes:
- './nginx/vhosts:/etc/nginx/vhost.d'
- './nginx/config:/etc/nginx/conf.d'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- './nginx/certs:/etc/nginx/certs'
- './nginx/fastcgi_params:/etc/nginx/fastcgi_params' #<-this!
php:
container_name: php
build:
context: ./php/
environment:
VIRTUAL_HOST: "${BACKEND}"
VIRTUAL_ROOT: "/var/www/html/web"
VIRTUAL_PROTO: fastcgi
VIRTUAL_PORT: 9000
volumes:
- '../backend:/var/www/html' but i do like this:: php-proxy:
image: nginx
container_name: php-proxy
volumes:
- './php/proxy/conf:/etc/nginx/conf.d'
environment:
VIRTUAL_HOST: "${BACKEND}"
links:
- php
volumes_from:
- php
php:
container_name: php
build:
context: ./php/
volumes:
- '../backend:/var/www/html' |
I opened a MR to fix this #2011 Basically the old jwilder image used to include SCRIPT_FILENAME in the I guess at some point upstream nginx decided not to include that variable in The examples still suggest that SCRIPT_FILENAME is included |
I just searched through the commits and there is some that actually revert the change |
Any progress on this issue? |
I am unable to get this to work via fastcgi with a simple php-fpm container. Here's my
docker-compose.yml
file:I then drop in a simple
index.php
file by running:(It puts
web_
in front because this project is in a directory namedweb/
.)I also modify my
hosts
file to pointtest.local
to127.0.0.1
, so I can test it.However, every attempt to browse to
test.local
results in a blank white page.The logs for the
web_fpm_1
container show that nothing gets sent except a 200 response:What am I doing wrong?
The text was updated successfully, but these errors were encountered: