环境:
AlmaLinux9.1 或者 RockyLinux9.1
Nginx 1.22
php 7.4
mariadb 10.6.11
phpipam版本1.5
PHP:
安装remi repo
php74-php-fpm.x86_64
php74-php-pdo.x86_64
php74-php-mysqlnd.x86_64
php74-php-gd.x86_64
php74-php-mbstring.x86_64
php74-php-pear.noarch
php74-php-gmp.x86_64
Nginx配置:
server {
# root directory
root /usr/share/nginx/html/;
# phpipam
location /phpipam/ {
try_files $uri $uri/ /phpipam/index.php;
index index.php;
}
# phpipam - api
location /phpipam/api/ {
try_files $uri $uri/ /phpipam/api/index.php;
}
# php-fpm
location ~ \.php$ {
fastcgi_pass unix: /var/opt/remi/php74/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri $uri/ index.php = 404;
include fastcgi_params;
}
}
MariaDB配置:
mysql -uroot
create user 'phpipam'@'10.0.10.0/255.255.255.0' identified by 'phpipamadmin';
grant all privileges on phpipam.* to 'phpipam'@'10.0.10.0/255.255.255.0';
flush privileges;
create database phpipam;
phpipam配置:
php-fpm配置:
user = nginx
group = nginx
listen.acl_users = apache,nginx
如果报错关键字session permission deny,将session文件夹换组nginx
[root@localhost ~]# ll /var/opt/remi/php74/lib/php/
total 0
drwxrwx--- 2 root apache 6 Dec 19 21:30 opcache
drwxr-xr-x 2 root root 6 Dec 19 21:30 peclxml
drwxrwx--- 2 root apache 6 Dec 19 21:30 session
drwxrwx--- 2 root apache 6 Dec 19 21:30 wsdlcache
[root@localhost ~]# chgrp nginx opcahe -R
chgrp: cannot access 'opcahe': No such file or directory
[root@localhost ~]# cd /var/opt/remi/php74/lib/php/
[root@localhost php]# chgrp nginx opcahe -R
chgrp: cannot access 'opcahe': No such file or directory
[root@localhost php]# chgrp -R nginx opcache/
[root@localhost php]# chgrp -R nginx session/
[root@localhost php]# chgrp -R nginx wsdlcache/
[root@localhost php]# ll
total 0
drwxrwx--- 2 root nginx 6 Dec 19 21:30 opcache
drwxr-xr-x 2 root root 6 Dec 19 21:30 peclxml
drwxrwx--- 2 root nginx 6 Dec 19 21:30 session
drwxrwx--- 2 root nginx 6 Dec 19 21:30 wsdlcache
http://x.x.x.x/phpipam/