lnmp源码安装

本文详细介绍了如何从源代码安装Nginx,包括设置用户、编译选项及配置,以及后续的PHP源码安装、php-fpm服务配置和解决安装过程中遇到的问题,如oniguruma和libzip扩展的安装。

nginx源码安装

useradd -M -s /sbin/nologin nginx

cd  nginx

./configure \

--prefix=/usr/local/nginx  \

--user=nginx \

--group=nginx \

--with-debug \

--with-http_ssl_module \

--with-http_realip_module \

--with-http_image_filter_module \

--with-http_gunzip_module \

--with-http_gzip_static_module \

--with-http_stub_status_module \

--http-log-path=/var/log/nginx/access.log \

--error-log-path=/var/log/nginx/error.log

make && make install

ln -s  /usr/local/nginx/sbin/nginx  /sbin/

nginx -s reload  #重新加载配置文件

nginx -t 测试配置文件

nginx -s stop 停止nginx

php源码安装

./configure --prefix=/usr/local/php8 --with-config-file-path=/usr/local/php8/etc  --with-curl --with-freetype --enable-gd --with-jpeg  --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql  --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv  --enable-fpm --enable-pdo  --enable-bcmath  --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl  --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-sysvsem --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-mysqlnd --disable-fileinfo

ln -s /usr/local/php8/ /usr/local/php

cp php.ini-production /usr/local/php/etc/php.ini

cp /usr/local/php/etc/php-fpm.d/www.conf.default www.conf

cp php-fpm.conf.default php-fpm.conf

cp sapi/fpm/init.d.php-fpm /usr/local/php/daemon

chmod 740 /usr/local/php/daemon/init.d.php-fpm

配置php-fpm启动

vim /etc/systemd/system/php-fpm.service

[Unit]

Description=The PHP FastCGI Process Manager

After=syslog.target network.target

[Service]

Type=simple

PIDFile=/run/php-fpm.pid

ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf

ExecReload=/bin/kill -USR2 $MAINPID

ExecStop=/bin/kill -SIGINT $MAINPID

[Install]

WantedBy=multi-user.target

systemctl daemon-reload

systemctl start php-fpm

systemctl status php-fpm

安装PHP找不到包 No package 'oniguruma' found错误

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz

tar -xvf oniguruma-6.9.4.tar.gz

 cd oniguruma-6.9.4/

./autogen.sh

./configure --prefix=/usr/local/oniguruma  --libdir=/lib64   

//64位的系统一定要标识  --libdir=/lib64 否则还是不行

Linux php安装libzip扩展

1.下载包

wget https://nih.at/libzip/libzip-1.2.0.tar.gz --no-check-certificate

2.安装libzip

tar -zxvf libzip-1.2.0.tar.gz

cd libzip-1.2.0/

./configure

make && make install

执行这个,导入变量

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值