0

I'm meeting a problem with getting my nginx and php-fpm working.

I'm getting an error 504 when I try to access my application.

I have a structure like this;

data/mywebsite/
 |    
 |---revisions/
 |
 |---shared/
 |
 |---released/
       |---web/
       |---app/
       |---.../

in my fpm pool I have the following:

chroot = /data/mywebsite/
chdir = /released/web/

in my nginx:

root /data/mywebsite/released/web/;

fastcgi_param                  SCRIPT_FILENAME              /web/released$fastcgi_script_name;

So what I want is to chroot on data/mywebsite/ and the application located in data/mywebsite/released/web/ to access files in the folder shared.

nb: I don't know if it is worth mentioning but I have a soft link like this released -> /data/mywebsite/revisions/...

2
  • Have you mixed /data/mybesite and /data/mywebsite in the question? Jul 3, 2017 at 10:29
  • Indeed i made a mistake in the question. It's "mywebsite" everywhere, thank you for your answer.
    – Martinouh
    Jul 3, 2017 at 11:52

1 Answer 1

0

When you plan to use PHP-FPM chroot, you need to copy quite a lot of system files inside the chroot for it to work properly.

For example, you need /data/mybesite/dev, /data/mybesite/proc, /data/mybesite/sys directories / pseudo-filesystems and files inside /data/mybesite/lib and many others.

You also cannot use symlinks that point outside the chroot.

If you are using /data/mybesite as the chroot directory, then a symlink in /data/mybesite/example1/example2 that points to /data/mybesite/example2 points to /data/mybesite/data/mybesite/example2 directory when used inside the chroot.

My recommendation is not to use the chroot feature unless you are prepared to spend time learning the requirements for the chroot environment to run PHP-FPM applications inside it. I did this work for one project I worked on, and it took several days even when using a helper program for the job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .