Zabbix学习笔记(二)- Nginx的编译安装(为搭建zabbix系统)
1、 环境介绍
操作系统:Centos7.3 Linux
版本:nginx-1.14.2
镜像源:阿里镜像源
2、 安装依赖包
yum install -y wget gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel
3、 安装nginx
版本:nginx-1.14.2
tar zxf nginx-1.14.2.tar.gz
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx
make
make install
4、 启动
修改环境变量:
Vi /etc/profile
PATH=$PATH:/usr/local/nginx/sbin/
nginx –t #检查nginx配置
nginx #启动
ss –lntup#进程检查
nginx -s stop #关闭nginx
5、 配置文件的位置
Nginx配置文件:conf/nginx.conf
Nginx日志文件:
Nginx的文件目录:
/usr/local/nginx/sbin、conf、logs、html
6、 nginx处理php程序
vi /usr/local/nginx/conf/nginx.conf
1、
location / {
root html;
index index.html index.htm;
}
修改为:
location / {
root html;
index index.html index.htm index.php;
}
2、
#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;
#}
修改为:
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$ fastcgi_script_name;
include fastcgi_params;
}
7、 测试
Zabbix系列请看下集-php的安装