wyveo / nginx-php-fpm

Nginx + PHP-FPM 8.2.x / 8.1.x / 8.0.x / 7.4.x / 7.3.x / 7.2.x / 7.1.x / 7.0.x + Composer built on Debian (Bullseye/Buster) image
https://hub.docker.com/r/wyveo/nginx-php-fpm
MIT License
342 stars 245 forks source link

Getting 404 after startup #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hey,

This is great, just can't seem to get around this issue. After running sudo compose-build up and opening my localhost, I get this error:

web_1      | 2017/04/13 00:16:55 [crit] 18#18: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "127.0.0.1"
web_1      | 2017/04/13 00:16:55 [error] 18#18: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock", host: "127.0.0.1"
web_1      | 172.17.0.1 - - [13/Apr/2017:00:16:55 +0000] "GET / HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"

Any ideas what might be going on?

colinwilson commented 7 years ago

Try adding:

upstream fastcgi_backend {
    server 127.0.0.1:9000;
}

To the nginx default.conf file.

ghost commented 7 years ago

Yeah I saw that in a thread somewhere, but I'm getting this:

"upstream" directive is not allowed here in /etc/nginx/conf.d/default.conf

which shuts nginx down

colinwilson commented 7 years ago

Try adding it to the /etc/nginx/nginx.conf file instead.

ghost commented 7 years ago
"upstream" directive is not allowed here in /etc/nginx/nginx.conf:13
colinwilson commented 7 years ago

Sorry, did you place it inside the http block?

ghost commented 7 years ago

No longer getting that error on nginx startup, but its still not able to connect to the php7.0-fpm.sock file

web_1      | 2017/04/13 22:15:42 [crit] 18#18: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "localhost"
web_1      | 2017/04/13 22:15:42 [error] 18#18: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock", host: "localhost"

Here's the contents of my etc/nginx/nginx.conf file:


user  nginx;
worker_processes 2;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    upstream fastcgi_backend {
       server 127.0.0.1:9000;
    }

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
colinwilson commented 7 years ago

Sorry. Quick question, are you in fact trying to use the craftcms-docker repo?

ghost commented 7 years ago

I repurposed that repo to work with Craft 3--its a work in progress. We're having all sorts of dependency issues and my machine doesn't have enough storage for vagrant, so I'm trying to make Docker work.

So far, after beta12, its working really great. I get all sorts of "unknown errors" in the dashboard on craft3 when I try to run it on my system configs, but my docker containers run great.

Why do you ask?

-- Travis Meyer

(sent via mobile)

On Apr 15, 2017, 16:36 -0700, Colin Wilson notifications@github.com, wrote:

Sorry. Quick question, are you in fact trying to use the craftcms-docker (https://github.com/wyveo/craftcms-docker) repo?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub (https://github.com/wyveo/nginx-php-fpm/issues/1#issuecomment-294324012), or mute the thread (https://github.com/notifications/unsubscribe-auth/AG2NRAxGInMRaVFFK5gx49LFqplVukPuks5rwVRvgaJpZM4M8IHE).

ghost commented 7 years ago

Sorry I just realized you're not Brandon from pixel and tonic (been communicating back and forth with him), I actually fixed this issue! I'll put some notes in the issue thread and close it out asap

Thanks Colin!

-- Travis Meyer

(sent via mobile)

On Apr 15, 2017, 16:36 -0700, Colin Wilson notifications@github.com, wrote:

Sorry. Quick question, are you in fact trying to use the craftcms-docker (https://github.com/wyveo/craftcms-docker) repo?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub (https://github.com/wyveo/nginx-php-fpm/issues/1#issuecomment-294324012), or mute the thread (https://github.com/notifications/unsubscribe-auth/AG2NRAxGInMRaVFFK5gx49LFqplVukPuks5rwVRvgaJpZM4M8IHE).

colinwilson commented 7 years ago

I noticed that you said you ran the sudo compose-build up command, and also that that repo's default.conf is configured for php 7.0.x not php 7.1 which is the image it's pulling.

I'll update it soon.

ghost commented 7 years ago

Yep, thats the fix exactly

-- Travis Meyer

(sent via mobile)

On Apr 15, 2017, 16:59 -0700, Colin Wilson notifications@github.com, wrote:

I noticed that you said you ran the sudo compose-build up command, and also that that repo's default.conf is configured for php 7.0.x not php 7.1 which is the image it's pulling.

I'll update it soon.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub (https://github.com/wyveo/nginx-php-fpm/issues/1#issuecomment-294324783), or mute the thread (https://github.com/notifications/unsubscribe-auth/AG2NRDM59F1pL_BvjEsDiOgUYK6aVYt4ks5rwVnwgaJpZM4M8IHE).

colinwilson commented 7 years ago

Cool. I'll close this issue and update the other repo. Will also create a Craft 3 (Beta) branch too.