一、安装nginx
1.gentoo-chxf ~ # emerge -av nginx
提示配置文件需更新
2.gentoo-chxf ~ # etc-update
3.gentoo-chxf ~ # emerge -av nginx
4.查看并启动nginx
gentoo-chxf ~ # systemctl status nginx
gentoo-chxf ~ # systemctl start nginx
gentoo-chxf ~ # systemctl enable nginx
二、安装mariadb
1.gentoo-chxf /etc/nginx # emerge -av mariadb
2.gentoo-chxf /etc/mysql # emerge --config =dev-db/mariadb-10.6.17
3.查看并启动mariadb
gentoo-chxf /etc/mysql # systemctl status mysqld
gentoo-chxf /etc/mysql # systemctl start mysqld
gentoo-chxf /etc/mysql # systemctl enable mysqld
4.可登录数据库
三、安装php
1.#emerge -av php
发现少了一些扩展
2.补充php扩展
(1)#cd /etc/portage/package.use
(2)#vim php
dev-lang/php iconv mbstring curl openssl tokenizer soap ctype zip zlib gd simplexml spl pcre dom xml xmlreader intl json hash fileinfo sodium exif memory_limit file_uploads opcache mysqli pdo fpm sockets bcmath
(3)#etc-update
3.emerge -av dev-lang/php
(1)gentoo-chxf /etc/portage/package.use # emerge -av dev-lang/php
提示更新配置文件
编译安装(过程截图)
(2)gentoo-chxf /etc/portage/package.use # emerge --config =mail-mta/nullmailer-2.2-r2
4.查看并启动php
gentoo-chxf /usr/lib/systemd/system # systemctl status php-fpm@8.2.service
gentoo-chxf /usr/lib/systemd/system # systemctl start php-fpm@8.2.service
gentoo-chxf /usr/lib/systemd/system # systemctl enable php-fpm@8.2.service
四、部署LNMP
1.查看nginx、mariadb、php运行情况
2.部署lnmp
思路:
(1)php连接mariadb:安装已自动完成;
(2)php->php-fpm.sock;
#vim www.conf
重启php-fpm
gentoo-chxf /etc/php/fpm-php8.2/fpm.d # systemctl restart php-fpm@8.2.service
(3)nginx->php-fpm.sock
重启nginx
gentoo-chxf /etc/php/fpm-php8.2/fpm.d # systemctl restart nginx
3.用phpinfo.php来检测部署
部署完成,可访问: