静态IP
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static" # 使用静态IP地址,默认为dhcp
IPADDR="192.168.80.128" # 设置的静态IP地址
NETMASK="255.255.255.0" # 子网掩码
GATEWAY="192.168.80.2" # 网关地址
DNS1="192.168.80.2" # DNS服务器
ONBOOT="yes" #是否开机启用
开启ssh
vi /etc/ssh/sshd_config
#Port 22去掉#号
#PermitRootLogin yes去掉#号
PasswordAuthentication yes
安装Nginx前准备:
1、gcc,编译Nginx源码;
yum install gcc
2、PCRE,Nginx的http模块使用pcre解析正则表达式;
yum install pcre pcre-devel
3、zlib,对http包进行gzip打包;
yum install zlib zlib-devel
4、OpenSSL,用来支持https。
yum install openssl openssl-devel
下载Nginx源码
yum install net-tools
yum install wget
wget -c https://nginx.org/download/nginx-1.20.1.tar.gz
解压、编译
tar -zxvf nginx-1.20.1.tar.gz
cd nginx-1.20.1
./configure
make && make install
注册成服务
新建vi /etc/init.d/nginx,内容:
#! /bin/sh
# chkconfig: - 85 15
PATH=/usr/local/nginx/sbin
DESC="nginx daemon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
CONFIGFILE=/usr/local/nginx/conf/$NAME.conf
PIDFILE=/usr/local/nginx/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
$DAEMON -s stop || echo -n "nginx not running"
}
do_reload() {
$DAEMON -s reload || echo -n "nginx can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0
添加服务
chmod a+x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
systemctl start nginx
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
下载php源码
wget -c http://au1.php.net/get/php-7.4.23.tar.gz/from/this/mirror
解压、编译
tar -zxvf mirror
cd php-7.4.23
yum install libxml2 libxml2-devel sqlite-devel
./configure --enable-sockets --enable-fpm --enable-mysqlnd --enable-mysqlnd-compression-support --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
make && make install
配置
cp php.ini-production /usr/local/lib/php.ini
编辑php.ini,将extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20190902/"
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
添加用户、用户组
cd /usr/local/php
groupadd www
useradd -g www www
编辑vi /usr/local/etc/php-fpm.conf
改成:
pid = run/php-fpm.pid
include=/usr/local/etc/php-fpm.d/*.conf
编辑vi /usr/local/etc/php-fpm.d/www.conf
改成:
user = www
group = www
pm.max_children = 150
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 10
启动php-fpm
chmod 755 /etc/rc.local
vi /etc/rc.local增加一行
/usr/local/sbin/php-fpm -c /usr/local/lib/php.ini
整合进nginx
vi /usr/local/nginx/conf/nginx.conf
增加:
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
#index index.html index.htm;
}
oci8扩展:
oracle客户端:
下载链接:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
cd ext/oci8
yum install autoconf
/usr/local/bin/phpize
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/lib --with-php-config=/usr/local/bin/php-config
make && make install
将得到的目录添加到php.ini,新增一行:
extension = oci8.so