Skip to content
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

nginx and FastCGI - "Primary script unknown" #319

Closed
renan-taranto opened this Issue Jun 1, 2017 · 13 comments

Comments

Projects
None yet
3 participants
@renan-taranto
Copy link

renan-taranto commented Jun 1, 2017

Hi,

I've just downloaded the framework from the master branch and after running docker-compose up -d, I got the following error when requesting for http://localhost:

nginx_1  | 2017/06/01 12:25:31 [error] 7#7: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.18.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://172.18.0.4:9000", host: "localhost"

nginx returns a 404 status code response with the text "File not found" in the content.

Im using Linux. Any ideas?

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jun 1, 2017

I've just tried it but unable to reproduce (I'm also using Linux). Can you provide more info?

@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 1, 2017

Sure @teohhanhui

Im using:

  1. Linux Mint Rosa 17.3 64bit
  2. docker-compose version 1.14.0-rc1
  3. Docker version 17.04.0-ce, build 4845c56

Here's everything I did:

  1. From the master branch I downloaded the zip api-platform-master.zip and extracted it
  2. Ran $ docker-compose up -d and the output was: https://gist.github.com/renan-taranto/cad044c5df8ed1de1ababd6e74b595c4
  3. After building I opened Chromium and navigated to http:\\localhost\app_dev.php
  4. I ran docker-compose logs -f and the output was
    https://gist.github.com/renan-taranto/d262a2cdf57c6137099d939ef77e4836

Let me know if I can provide more info.

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jun 1, 2017

You seem to have a file permissions problem. Hmm...

@Simperfit

This comment has been minimized.

Copy link
Member

Simperfit commented Jun 6, 2017

With what user are you running docker ? and what are the perms on the files ?

@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 7, 2017

@Simperfit I'm running with the linux mint "standard" user account which has sudo privileges. I'm used to run dockerized apps with compose using this account so I'm not sure if the problem is my local setup. I still have errors even if I run with sudo privileges $ sudo docker-compose up -d.

Today I downloaded the project from the master branch again and varnish breaks due to permissions:
varnish_1 | Error: Cannot read -f file (/etc/varnish/default.vcl): Permission denied

The permissions looks like this after trying to bring the containers up: https://gist.github.com/renan-taranto/3eb8632b313243884abec7689b604074

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jun 7, 2017

There is no need to run with sudo, because obviously your user is in the docker group, otherwise it wouldn't have worked...

https://docs.docker.com/engine/installation/linux/linux-postinstall/

But also, this is probably hard for us to troubleshoot unless someone has a similar setup and can investigate.

Just off the top of my head, perhaps you are using user namespaces? https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-user-namespace-options

@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 7, 2017

@teohhanhui I mentioned I had no success even with sudo because I was asked about the user I was using to run it and about permissions.
I'm not using user namespaces.

@Simperfit

This comment has been minimized.

Copy link
Member

Simperfit commented Jun 7, 2017

@renan-taranto what are the permissions on the varnish vcl ?

@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 7, 2017

@Simperfit

renan@taranto ~/projects/api-platform-master/docker/varnish/conf $ ls -la
total 12
drwx------ 2 renan renan 4096 Jun  6 22:00 .
drwx------ 3 renan renan 4096 Jun  6 22:00 ..
-rw-r--r-- 1 renan renan 1934 Jun  6 15:53 default.vcl
@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 7, 2017

It is related to file permissions. I did the following tests:

  • $ chmod a+rwx docker/varnish/conf/default.vcl "solves" the varnish error and gives me the FastCGI - "Primary script unknown" error back again;
  • $ chmod a+rwx -R api-platform-master/ "solves" both problems and the app works.
@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jun 8, 2017

Do you have SELinux enabled? That's the only similar symptom that I can find...

See https://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker and http://www.projectatomic.io/blog/2016/03/dwalsh_selinux_containers/

Otherwise, I'm not sure what problem you're running into. But you're on very old Linux kernel (3.19), right?

@teohhanhui

This comment has been minimized.

Copy link
Member

teohhanhui commented Jun 8, 2017

Oh, okay. It's actually a problem with the .zip archive not preserving the correct file permissions. I'd suggest you do a git clone instead (as you should). You could also use the tarball (.tar.gz).

@renan-taranto

This comment has been minimized.

Copy link
Author

renan-taranto commented Jun 8, 2017

Solved. Cloning instead of downloading the zip solves. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.