Alma linux 9 issue with nginx and php

Hi,
I have a brand new alma linux 9 setup. So first I setup the nginx from its original nginx repo. Then I followed this link How to Install PHP 8 on RHEL 9 | Rocky Linux 9 | AlmaLinux 9 to install php8.3. Here conf file ; Start a new pool named 'www'.; the variable $pool can be used in any directi - Pastebin.com from /etc/php-fpm.d/www.conf.
I have replace all the apache user to nginx in that conf. The issue comes with nginx: [emerg] no port in upstream “php-fpm” in /etc/nginx/default.d/php.conf:13. Below is the content of that file

# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
#
index index.php index.html index.htm;

location ~ \.php$ {
try_files $uri =404;
fastcgi_intercept_errors on;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-fpm;
}

I have tried putting fastcgi_pass php-fpm:9000; still the same it does not work. What other settings is need to over come this use?

Using nginx and php-fpm from official repository, everything works out of the box without any configuration change.

P.S.

  • php-fpm installed from alternative stream from remi-modular also works
  • nginx from nginx repository doesn’t work out of the box.

Hi Remi,
For nginx this how I installed it

[nginx]

name=nginx repo

baseurl=https://nginx.org/packages/centos/$releasever/$basearch/

gpgcheck=0

enabled=1

yum install nginx
So its confirm from the official repository. I dont get you regarding the php-fpm official repository so should I remove the whole php.

I dont get your these message which you say * nginx from nginx repository doesn’t work out of the box ? So kind of confusing ?

By official, I mean from AlmaLinux repository.

I dont get your these message which you say * nginx from nginx repository doesn’t work out of the box ?

You are using nginx repo, so not the official one from AlmaLinux (version 1.20, 1.22 or 1.24)

So its confirm from the official repository.

No.

I dont get you regarding the php-fpm official repository so should I remove the whole php.

No

Official AlmaLinux have PHP 8.0, 8.1 or 8.2
According to link in your initial post you are using 8.3 from “remi-modular” (which have 7.4, 8.0, 8.1, 8.2 or 8.3 with more extensions).

Both AlmaLinux and Remi packages are OK with nginx from AlmaLinux.

So kind of confusing ?

nginx/php packaging have been improved (in Fedora, then in CentOS => RHEL => AlmaLinux) to work out of the box.

Packages from nginx.org are not aware of how PHP is installed, so everything must be configured manually.

Hi Remi,
Ok now I am clear meaning official is from AlmaLinux itself. So now I would like to clean both nginx and php. Are these command correct.
For nginx. Did I miss anything just incase

sudo systemctl stop nginx.service
sudo systemctl disable nginx.service

sudo chkconfig nginx off

sudo rm -rf /etc/nginx
sudo rm -rf /etc/init.d/nginx
sudo rm -rf /var/log/nginx
sudo rm -rf /var/cache/nginx/
sudo rm -rf /usr/sbin/nginx

sudo rm -rf /usr/lib/systemd/system/nginx.service
sudo dnf remove nginx

For php I ran this

sudo yum remove --setopt=clean_requirements_on_remove=1 php php-pear php-mysql php-cli php-common mod-php

Then I did this
sudo yum remove --setopt=clean_requirements_on_remove=1 php-fpm php-cli php-common php-fpm php-cli php-common

So is there anything else I am missing for php removal.

Now what command should I use for it to install from the official repo and not other repo ?

You don’t need to remove php…

By removing the nginx.repo configuration file

Hi Remi,
Opps sorry I remove php too. Yes I remove the the repo rm nginx.repo. Just to confirm now its taking from the official repo right


 > yum install nginx
> AlmaLinux 9 - AppStream                         4.0 MB/s | 8.8 MB     00:02
> AlmaLinux 9 - BaseOS                            2.4 MB/s | 4.6 MB     00:01
> AlmaLinux 9 - Extras                            3.1 kB/s |  18 kB     00:05
> Extra Packages for Enterprise Linux 9 - x86_64  2.6 MB/s |  21 MB     00:08
> Extra Packages for Enterprise Linux 9 openh264  663  B/s | 2.5 kB     00:03
> Percona Release release/noarch YUM repository   590  B/s | 1.8 kB     00:03
> Percona Server 8.0 release/x86_64 YUM repositor 119 kB/s | 2.8 MB     00:24
> Percona Tools release/x86_64 YUM repository     166 kB/s | 1.4 MB     00:08
> Remi's Modular repository for Enterprise Linux   11 kB/s | 673 kB     01:02
> Safe Remi's RPM repository for Enterprise Linux 8.0 kB/s | 995 kB     02:04
> EL-9 - Wazuh                                    7.2 MB/s |  28 MB     00:03
> Dependencies resolved.
> ================================================================================
>  Package                Arch    Version                        Repository  Size
> ================================================================================
> Installing:
>  nginx                  x86_64  1:1.20.1-14.el9_2.1.alma.1     appstream   36 k
> Installing dependencies:
>  almalinux-logos-httpd  noarch  90.5.1-1.1.el9                 appstream   18 k
>  nginx-core             x86_64  1:1.20.1-14.el9_2.1.alma.1     appstream  565 k
>  nginx-filesystem       noarch  1:1.20.1-14.el9_2.1.alma.1     appstream  8.4 k
> 
> Transaction Summary
> ================================================================================
> Install  4 Packages
> 
> 
> 
> .

So how about php what do you suggest temporary disable remi repo so that it can pick from the official repo or just go with remi repo ?

I have install nginx now just before install php let me show you. I can see the repos are kind of mix of remi and official will it be ok.?

> yum install php
> Last metadata expiration check: 0:05:00 ago on Fri May 31 22:50:34 2024.
> Dependencies resolved.
> ====================================================================================================================================
>  Package                           Architecture            Version                              Repository                     Size
> ====================================================================================================================================
> Installing:
>  php                               x86_64                  8.3.7-1.el9.remi                     remi-modular                  1.8 M
> Installing dependencies:
>  apr                               x86_64                  1.7.0-12.el9_3                       appstream                     122 k
>  apr-util                          x86_64                  1.6.1-23.el9                         appstream                      94 k
>  apr-util-bdb                      x86_64                  1.6.1-23.el9                         appstream                      12 k
>  capstone                          x86_64                  4.0.2-10.el9                         appstream                     766 k
>  httpd-core                        x86_64                  2.4.57-8.el9                         appstream                     1.4 M
>  httpd-filesystem                  noarch                  2.4.57-8.el9                         appstream                      12 k
>  httpd-tools                       x86_64                  2.4.57-8.el9                         appstream                      80 k
>  libsodium                         x86_64                  1.0.18-8.el9                         epel                          161 k
>  mailcap                           noarch                  2.1.49-5.el9                         baseos                         32 k
>  oniguruma5php                     x86_64                  6.9.9-1.el9.remi                     remi-safe                     219 k
>  php-common                        x86_64                  8.3.7-1.el9.remi                     remi-modular                  1.2 M
> Installing weak dependencies:
>  apr-util-openssl                  x86_64                  1.6.1-23.el9                         appstream                      14 k
>  php-cli                           x86_64                  8.3.7-1.el9.remi                     remi-modular                  5.6 M
>  php-fpm                           x86_64                  8.3.7-1.el9.remi                     remi-modular                  1.9 M
>  php-mbstring                      x86_64                  8.3.7-1.el9.remi                     remi-modular                  579 k
>  php-opcache                       x86_64                  8.3.7-1.el9.remi                     remi-modular                  574 k
>  php-pdo                           x86_64                  8.3.7-1.el9.remi                     remi-modular                  119 k
>  php-sodium                        x86_64                  8.3.7-1.el9.remi                     remi-modular                   61 k
>  php-xml                           x86_64                  8.3.7-1.el9.remi                     remi-modular                  220 k
> 
> Transaction Summary
> ====================================================================================================================================
> Install  20 Packages

As I said, both work (same packaging)

  • if you want 8.0, with some extensions in EPEL, officials are fine
  • if you want 8.1/8.2, with a minimal set of extensions, officials are fine
  • if you want 8.3, or more extensions, only “remi” have it.

I have install nginx now just before install php let me show you. I can see the repos are kind of mix of remi and official will it be ok.?

Yes, this is expected (remi pull its dependencies from official repo and sometime EPEL)