This is a multi-part message in MIME format.
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello All,</p>
<p>I am Stefano from Torino, Italy; I am just new to this list,
nice to virtually meet all of you : )</p>
<p>I am writing to you because I need support for a strange issue I'
am facing.</p>
<p>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,</p>
<p>the procedure I am using is :</p>
<p><font face="monospace">[host] $ <span
style="color:#000000;background-color:#ffffff;"> podman run
-ti -p 8090:80 debian:12-slim</span></font></p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$</span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> apt update
</span>&& apt install vim nginx php-fpm <br>
</span></p>
<p><span style="color:#000000;background-color:#ffffff;">edit</span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">
`/etc/nginx/sites-enabled/default` </span></span><span
style="color:#000000;background-color:#ffffff;">de-commenting
the php part <br>
</span></p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> # pass
PHP scripts to FastCGI server
</span><br>
#
<br>
location ~ \.php$ {
<br>
include snippets/fastcgi-php.conf;
<br>
<br>
# With php-fpm (or other unix sockets):
<br>
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
<br>
# With php-cgi (or other tcp sockets):
<br>
#fastcgi_pass 127.0.0.1:9000;
<br>
}
<br>
<br>
</span></p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$</span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">
/etc/init.d/nginx start </span><br>
</span><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$ </span></span><span
style="font-family:monospace">/etc/init.d/php8.2-fpm start<br>
<br>
</span><span style="color:#000000;background-color:#ffffff;">edit</span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">
`/var/www/html/info.php using the content:`<br>
</span></span></p>
<blockquote>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"><?php<br>
phpinfo();<br>
?></span></span></p>
</blockquote>
<p>connecting<span style="font-family:monospace">
<a class="moz-txt-link-freetext" href="
http://localhost:8080">http://localhost:8080</a> </span>I get the default nginx page<span
style="font-family:monospace"><br>
</span></p>
<p>connecting<span style="font-family:monospace">
<a class="moz-txt-link-freetext" href="
http://localhost:8080/info.php">http://localhost:8080/info.php</a> </span>I got Access denied. <br>
</p>
<p>and the logs report :</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$ </span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">tail -n 2
/var/log/nginx/error.log </span><br>
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<br>
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"
<br>
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<br>
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"<br>
<br>
</span>It is strange because I the file <span
style="font-family:monospace">/var/www/html/info.php </span>exists
and have to much open permission 0:)</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$</span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> ls -l
/var/www/html/info.php </span><br>
-rwxrwxrwx 1 root root 20 Jul 6 13:03 /var/www/html/info.php<br>
</span></p>
<p>the socket <span style="font-family:monospace">/var/run/php/php8.2-fpm.sock
</span>exist and it seems ok:</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$</span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"></span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> ls -l
/var/run/php/php8.2-fpm.sock
</span><br>
srw-rw---- 1 www-data www-data 0 Jul 6 13:14
/var/run/php/php8.2-fpm.sock<br>
<br>
</span>all the workers seem running using the right user:</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">[container]$</span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"> </span></span><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">ps -aux </span><br>
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME
COMMAND
<br>
root 1 0.0 0.0 4188 3216 pts/0 Ss 12:58 0:00
bash
<br>
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)
<br>
www-data 7256 0.0 0.0 201548 10792 ? S 13:14 0:00
php-fpm: pool www
<br>
www-data 7257 0.0 0.0 201548 10664 ? S 13:14 0:00
php-fpm: pool www
<br>
root 7364 0.0 0.0 10336 1512 ? Ss 13:19 0:00
nginx: master process /usr/sbin/nginx
<br>
www-data 7365 0.0 0.0 10960 4104 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7366 0.0 0.0 10960 4244 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7367 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7368 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7369 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7370 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7371 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7372 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7373 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7374 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7375 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
www-data 7376 0.0 0.0 10688 2684 ? S 13:19 0:00
nginx: worker process
<br>
root 7386 0.0 0.0 8060 4248 pts/0 R+ 13:51 0:00
ps -aux<br>
<br>
</span></p>
<p>So I have the feeling I am missing something stupid... but what
??</p>
<p>Can you help me ?</p>
<p>Thanks in advance</p>
<p>Stefano<br>
</p>
<p><span style="font-family:monospace"><br>
</span></p>
<p><span style="font-family:monospace"> <br>
</span><span style="font-family:monospace"><br>
</span></p>
<p><span style="font-family:monospace"><br>
</span></p>
</body>
</html>
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)