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





