文章目录
前言
安装服务器:
nginx: 1.20.1
php:8.0.11
mysql:8.0.26
redis:6.2.6
一、redis安装
下载地址:http://download.redis.io/releases/
# su root
# mkdir /mysoft
# cd /mysoft
# wget http://download.redis.io/releases/redis-6.2.6.tar.gz
# tar -zxvf redis-6.2.6.tar.gz
# cd ./redis-6.2.6/
# make
# make install
二、PHP安装
# wget https://www.php.net/distributions/php-8.1.1.tar.gz
# tar -zxvf php-8.0.11.tar.gz
# cd php-8.0.11
# yum install -y libxml2 libxml2-devel
# yum install -y sqlite sqlite-devel
# ./configure --enable-fpm --with-pdo-mysql
# make
# make install
# cp php.ini-development /usr/local/php/php.ini
# cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
# cp sapi/fpm/php-fpm /usr/local/bin
# cp /usr/local/etc/php-fpm.conf.defualt /usr/local/etc/php-fpm.conf
//修改最后 include=etc/php-fpm.d/*.conf
# vim /usr/local/etc/php-fpm.conf
# /usr/local/bin/php-fpm
多版本:
# wget https://www.php.net/distributions/php-7.4.21.tar.gz
# tar -zxvf php-7.4.21.tar.gz
# cd php-7.4.21
# ./configure --prefix=/usr/local/php74 --with-config-file-path=/usr/local/php74/etc --enable-fpm --with-pdo-mysql
# make
# make install
# cp php.ini-development /usr/local/php74/php.ini
# cp /usr/local/etc/php74/php-fpm.d/www.conf.default /usr/local/etc/php74/php-fpm.d/www.conf
# cp sapi/fpm/php-fpm /usr/local/bin/php74-fpm
# cp /usr/local/etc/php74/php-fpm.conf.defualt /usr/local/etc/php74/php-fpm.conf
//修改最后 include=php74/etc/php-fpm.d/*.conf
# vim /usr/local/php74/etc/php-fpm.conf
# /usr/local/bin/php-fpm
./configure --prefix=/usr/local/php54 --with-config-file-path=/usr/local/php54/etc
三、MYSQL安装
下载地址:MySQL :: Download MySQL Yum Repository
# wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
# rpm -ivh mysql80-community-release-el8-1.noarch.rpm
# yum install mysql-server
# systemclt start mysqld
# mysql -uroot -p
四、NGINX安装
下载地址:http://nginx.org/download/nginx-1.20.1.tar.gz
# wget http://nginx.org/download/nginx-1.20.1.tar.gz
# tar -zxvf nginx-1.20.1.tar.gz
# mkdir /mynginx
# cd nginx-1.20.1
# cp ./conf/nginx.conf /mynginx
# cp ./conf/mime.types /mynginx
//ssl
# yum install openssl-devel
//rewrite
# yum pcre pcre-devel
//gzip
# yum zlib zlib-devel
# ./configure
# make
# make install
# cd /usr/local/sbin
//启动
# ./nginx -c /mynginx/nginx.conf
//重启
# ./nginx -s reload
//停止
# ./nginx -s stop
五、NGINX配置fastcgi
# vim /usr/local/nginx/conf/nginx.conf
//加入
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# /usr/local/nginx/sbin/nginx -s stop
# /usr/local/nginx/sbin/nginx
# echo '<?php phpinfo(); ?>' >> index.php
|