question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fastcgi does not work

See original GitHub issue

I am unable to get this to work via fastcgi with a simple php-fpm container. Here’s my docker-compose.yml file:

version: "3"

services:
  proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    environment:
      - DEFAULT_HOST=test.local

  fpm:
    image: php:fpm
    environment:
      - VIRTUAL_HOST=test.local
      - VIRTUAL_PROTO=fastcgi

I then drop in a simple index.php file by running:

 docker container exec -it web_fpm_1 /bin/bash -c 'echo "<?php phpinfo(); ?>" > /var/www/html/index.php'

(It puts web_ in front because this project is in a directory named web/.)

I also modify my hosts file to point test.local to 127.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:

[06-Jul-2020 15:40:39] NOTICE: fpm is running, pid 1
[06-Jul-2020 15:40:39] NOTICE: ready to handle connections
172.19.0.3 -  06/Jul/2020:15:41:02 +0000 "- " 200
172.19.0.3 -  06/Jul/2020:15:41:03 +0000 "- " 200

What am I doing wrong?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
tkw1536commented, Oct 30, 2020

Based on the example by @flowl I have implemented https://github.com/tkw1536/nginx-proxy-fpm-workaround. This solution does not require manually intervening in the nginx-proxy container. It additionally serves non-php files statically.

2reactions
flowlcommented, Jul 25, 2020

@tkw1536 in the config is no try_files $uri $uri/ /index.php and in fastcgi_params or the default.conf there is no fastcgi_param SCRIPT_FILENAME $request_filename;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve FastCGI Issues | Media Temple Community
If you have enabled PHP to run as FastCGI on your DV server 4.0 or VPS server, this article may help you resolve...
Read more >
php - fastcgi does not work - wrapper dowloaded not run
So If I access website it gives it random name and when I look at downloaded contents it shows php5-fcgi contents. When I...
Read more >
PHP 7.2 fastcgi doesn't work on Ubuntu 18.04 server
I don't advise to use libapache2-mod-fastcgi module in Bionic or newer distro. Apache2 provides mod_proxy_fcgi module that proxies fcgi requests ...
Read more >
Issue - php fastcgi is not working = 500 (fpm works)
Hi, If I switch from php-fpm(7.2.14) to php-fastCGi i get ERROR 500. The Log shows me mod_fcgid: stderr: PHP Fatal error: Uncaught ...
Read more >
nginx + php-fastcgi: fastcgi suddenly not working - Linode
Does the www user have write access to the PID file? What do you get when you manually run the spawn-fcgi program as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found