配置nginx
//创建系统用户nginx
[root@server ~]# useradd -r -M -s /sbin/nologin nginx
//安装依赖环境
[root@server ~]# yum -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++
[root@server ~]# yum -y groups mark install 'Development Tools'
//创建日志存放目录
[root@server ~]# mkdir -p /var/log/nginx
[root@server ~]# chown -R nginx.nginx /var/log/nginx
//编译安装
[root@server ~]# tar xf nginx-1.14.2.tar.gz
[root@server ~]# cd nginx-1.14.2
[root@server nginx-1.14.2]# ./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
[root@server nginx-1.14.2]# make -j $(grep 'processor' /proc/cpuinfo | wc -l) && make install
//配置环境变量
[root@server nginx-1.14.2]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@server ~]# . /etc/profile.d/nginx.sh
[root@server ~]# nginx
[root@server ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:111 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:57330 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::111 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 128 :::49181 :::*
//修改配置文件
[root@server ~]# vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.params;
}
配置mysql
//安装依赖包和下载二进制mysql包
[root@server ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
[root@server ~]# groupadd -r -g 306 mysql
[root@server