安装前准备:
本次使用的软件包有:
nginx-1.10.2.tar.gz
mariadb-10.3.7.tar.gz
php-5.6.13.tar.bz2
zabbix-4.0.32.tar.gz
一、部署LNMP环境
1、安装nginx
[root@localhost src]# yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel
//zlib:给Nginx提供gzip模块;OPenssl提供SSL功能;PCRE,地址重写
[root@localhost ~]# cd /usr/src/
[root@localhost src]# tar xvf nginx-1.10.2.tar.gz
[root@localhost src]# cd /usr/src/nginx-1.10.2
[root@localhost nginx-1.10.2]# ./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module
[root@localhost nginx-1.10.2]# make
注1:可能会有报错make[1]: *** [objs/Makefile:470:objs/src/core/ngx_murmurhash.o] 错误 1
如下图:
报错原因:
编译过程中将警告作为错误处理,导致编译不通过报错。
解决方法:
[root@localhost nginx-1.10.2] # cd objs/
[root@localhost nginx-1.10.2] # vi Makefile
去掉如图所示参数 “-Werror”
注2:可能会出现报错:make[1]: *** [objs/Makefile:771:objs/src/os/unix/ngx_user.o] 错误 1
如下图所示报错:
解决方法:
[root@localhost nginx-1.10.2]# cd src/os/unix/
[root@localhost unix]# vi ngx_user.c
将 “cd.current_salt[0] = -salt[0];” 注释掉
注释方法为 “/* cd.current_salt[0] = -salt[0]; */ ”
[root@localhost nginx-1.10.2]# make install
[root@localhost nginx-1.10.2]# cd
[root@localhost ~]# useradd -u 8001 -M -s /sbin/nologin nginx
[root@localhost ~]#vim /usr/local/nginx/conf/nginx.conf
#user nobody;
user root; #此行添加
…… #下面这段内容,需要去掉注释,然后修改script_filename
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
[root@localhost ~]# /usr/local/nginx/sbin/nginx
[root@localhost ~]# ps -ef | grep nginx
[root@lo