Path: csiph.com!weretis.net!feeder8.news.weretis.net!fu-berlin.de!bofh.it!news.nic.it!robomod From: Stefano Prina Newsgroups: linux.debian.user Subject: Debian12 with nginx and php-fpm Date: Sat, 06 Jul 2024 16:00:01 +0200 Message-ID: X-Mailbox-Line: From debian-user-request@lists.debian.org Sat Jul 6 13:58:59 2024 Old-Return-Path: X-Amavis-Spam-Status: No, score=-4.898 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, BODY_8BITS=1.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FOURLA=0.1, HTML_MESSAGE=2, LDO_WHITELIST=-5, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, WORD_WITHOUT_VOWELS=1] autolearn=ham autolearn_force=no X-Policyd-Weight: using cached result; rate:hard: -5.5 Content-Type: multipart/alternative; boundary="------------gyusLmU83h6kzDbAXF3rm1Ts" MIME-Version: 1.0 Content-Language: en-US X-Mailing-List: archive/latest/812995 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/d03f1858-e00c-4ace-83e7-3be9fd06aee4@posteo.net Approved: robomod@news.nic.it Lines: 343 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Sat, 6 Jul 2024 13:58:39 +0000 X-Original-Message-ID: Xref: csiph.com linux.debian.user:270889 This is a multi-part message in MIME format. --------------gyusLmU83h6kzDbAXF3rm1Ts Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello All, I am Stefano from Torino, Italy;  I am just new to this  list, nice to virtually meet all of you : ) I am writing to you because I need support for a strange issue I' am facing. I am trying to create a debian container to run some php app for a side project, the idea is to use nginx and php-fpm, the procedure I am using is : [host] $ podman run -ti -p 8090:80 debian:12-slim [container]$apt update && apt install vim nginx php-fpm edit`/etc/nginx/sites-enabled/default` de-commenting the php part        # pass PHP scripts to FastCGI server        #        location ~ \.php$ {                include snippets/fastcgi-php.conf;                # With php-fpm (or other unix sockets):                fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;                # With php-cgi (or other tcp sockets):                #fastcgi_pass 127.0.0.1:9000;        } [container]$/etc/init.d/nginx start [container]$ /etc/init.d/php8.2-fpm start edit`/var/www/html/info.php using the content:` connectinghttp://localhost:8080 I get the default nginx page connectinghttp://localhost:8080/info.php I got Access denied. and the logs report : [container]$ tail -n 2 /var/log/nginx/error.log 2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090" 2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090" It is strange because I the file /var/www/html/info.php exists and have to much open permission 0:) [container]$ls -l /var/www/html/info.php -rwxrwxrwx 1 root root 20 Jul  6 13:03 /var/www/html/info.php the socket /var/run/php/php8.2-fpm.sock exist and it seems ok: [container]$ls -l /var/run/php/php8.2-fpm.sock srw-rw---- 1 www-data www-data 0 Jul  6 13:14 /var/run/php/php8.2-fpm.sock all the workers seem running using the right user: [container]$ps -aux USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND root         1  0.0  0.0   4188  3216 pts/0    Ss   12:58   0:00 bash root      7255  0.0  0.0 201548  8448 ?        Ss   13:14   0:00 php-fpm: master process (/etc/php/8.2/fpm/php-fpm.conf) www-data  7256  0.0  0.0 201548 10792 ?        S    13:14   0:00 php-fpm: pool www www-data  7257  0.0  0.0 201548 10664 ?        S    13:14   0:00 php-fpm: pool www root      7364  0.0  0.0  10336  1512 ?        Ss   13:19   0:00 nginx: master process /usr/sbin/nginx www-data  7365  0.0  0.0  10960  4104 ?        S    13:19   0:00 nginx: worker process www-data  7366  0.0  0.0  10960  4244 ?        S    13:19   0:00 nginx: worker process www-data  7367  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7368  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7369  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7370  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7371  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7372  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7373  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7374  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7375  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process www-data  7376  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process root      7386  0.0  0.0   8060  4248 pts/0    R+   13:51   0:00 ps -aux So I have the feeling I am missing something stupid... but what ?? Can you help me ? Thanks in advance Stefano --------------gyusLmU83h6kzDbAXF3rm1Ts Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hello All,

I am Stefano from Torino, Italy;  I am just new to this  list, nice to virtually meet all of you : )

I am writing to you because I need support for a strange issue I' am facing.

I am trying to create a debian container to run some php app for a side project, the idea is to use nginx and php-fpm,

the procedure I am using is :

[host] $ podman run -ti -p 8090:80 debian:12-slim

[container]$ apt update && apt install vim nginx php-fpm

edit `/etc/nginx/sites-enabled/default` de-commenting the php part

       # pass PHP scripts to FastCGI server
       #
       location ~ \.php$ {
               include snippets/fastcgi-php.conf;

               # With php-fpm (or other unix sockets):
               fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
               # With php-cgi (or other tcp sockets):
               #fastcgi_pass 127.0.0.1:9000;
       }

[container]$ /etc/init.d/nginx start
[container]$ /etc/init.d/php8.2-fpm start

edit `/var/www/html/info.php using the content:`

<?php
phpinfo();
?>

connecting  http://localhost:8080 I get the default nginx page

connecting  http://localhost:8080/info.php I got Access denied.

and the logs report :

[container]$ tail -n 2 /var/log/nginx/error.log  
2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp
onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090"
2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp
onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090"

It is strange because I the file /var/www/html/info.php exists and have to much open permission 0:)

[container]$ ls -l /var/www/html/info.php  
-rwxrwxrwx 1 root root 20 Jul  6 13:03 /var/www/html/info.php

the socket /var/run/php/php8.2-fpm.sock exist and it seems ok:

[container]$ ls -l /var/run/php/php8.2-fpm.sock
srw-rw---- 1 www-data www-data 0 Jul  6 13:14 /var/run/php/php8.2-fpm.sock

all the workers seem running using the right user:

[container]$ ps -aux  
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   4188  3216 pts/0    Ss   12:58   0:00 bash
root      7255  0.0  0.0 201548  8448 ?        Ss   13:14   0:00 php-fpm: master process (/etc/php/8.2/fpm/php-fpm.conf)
www-data  7256  0.0  0.0 201548 10792 ?        S    13:14   0:00 php-fpm: pool www
www-data  7257  0.0  0.0 201548 10664 ?        S    13:14   0:00 php-fpm: pool www
root      7364  0.0  0.0  10336  1512 ?        Ss   13:19   0:00 nginx: master process /usr/sbin/nginx
www-data  7365  0.0  0.0  10960  4104 ?        S    13:19   0:00 nginx: worker process
www-data  7366  0.0  0.0  10960  4244 ?        S    13:19   0:00 nginx: worker process
www-data  7367  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7368  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7369  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7370  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7371  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7372  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7373  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7374  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7375  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
www-data  7376  0.0  0.0  10688  2684 ?        S    13:19   0:00 nginx: worker process
root      7386  0.0  0.0   8060  4248 pts/0    R+   13:51   0:00 ps -aux

So I have the feeling I am missing something stupid... but what ??

Can you help me ?

Thanks in advance

Stefano


 


--------------gyusLmU83h6kzDbAXF3rm1Ts--