安装zabbix 编译lnmp环境

1.1 解决依赖

yum install gcc gcc-c++ pcre-devel openssl-devel libxml2-devel  GeoIP-devel bzip2-devel libmcrypt-devel  \

libXpm-devel ncurses-devel libxslt-devel  net-snmp-devel libpng-devel mcrypt mhash-devel libevent-devel \

libcurl-devel  gd gd-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel autoconf \

1.2 下载安装包
wget http://nginx.org/download/nginx-1.8.0.tar.gz

1.3 建立用户www

groupadd -g 108 -r www

useradd -u 108 -r -g 108  www

1.4 编译安装

mkdir /data/application

mkdir /data/logs/nginx –pv
tar xf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --user=www --group=www --prefix=/data/application/nginx  --with-http_ssl_module  --with-http_spdy_module  --with-http_realip_module  --with-http_addition_module  --with-http_xslt_module  --with-http_image_filter_module  --with-http_geoip_module  --with-http_sub_module  --with-http_dav_module  --with-http_flv_module  --with-http_mp4_module  --with-http_gunzip_module  --with-http_gzip_static_module  --with-http_auth_request_module  --with-http_random_index_module  --with-http_secure_link_module  --with-http_degradation_module  --with-http_stub_status_module --http-client-body-temp-path=/data/application/nginx/tmp/client   --http-proxy-temp-path=/data/application/nginx/tmp/proxy/   --http-fastcgi-temp-path=/data/application/nginx/tmp/fcgi --http-uwsgi-temp-path=/data/application/nginx/tmp/uwsgi   --http-scgi-temp-path=/data/application/nginx/tmp/scgi   --with-pcre

make && make install

[[email protected] application]# tree /data/application/nginx/
/data/application/nginx/
├── conf
│   ├── fastcgi.conf
│   ├── fastcgi.conf.default
│   ├── fastcgi_params
│   ├── fastcgi_params.default
│   ├── koi-utf
│   ├── koi-win
│   ├── mime.types
│   ├── mime.types.default
│   ├── nginx.conf
│   ├── nginx.conf.default
│   ├── scgi_params
│   ├── scgi_params.default
│   ├── uwsgi_params
│   ├── uwsgi_params.default
│   └── win-utf
├── html
│   ├── 50x.html
│   └── index.html
├── logs
└── sbin
    └── nginx

1.5 启动脚本

#!/bin/sh

#

# nginx - this script starts and stops the nginx daemon

#

# chkconfig:   - 85 15

# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \

#               proxy and IMAP/POP3 proxy server

# processname: nginx

# config:      /etc/nginx/nginx.conf

# config:      /etc/sysconfig/nginx

# pidfile:     /var/run/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/data/application/nginx/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/data/application/nginx/conf/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {

# make required directories

user=`nginx -V 2>&1 | grep "configure arguments:" | sed ‘s/[^*]*--user=\([^ ]*\).*/\1/g‘ -`

options=`$nginx -V 2>&1 | grep ‘configure arguments:‘`

for opt in $options; do

if [ `echo $opt | grep ‘.*-temp-path‘` ]; then

value=`echo $opt | cut -d "=" -f 2`

if [ ! -d "$value" ]; then

# echo "creating" $value

mkdir -p $value && chown -R $user $value

fi

fi

done

}

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

make_dirs

echo -n $"Starting $prog: "

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

}

restart() {

configtest || return $?

stop

sleep 1

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"

exit 2

esac

[[email protected] application]# vim /etc/init.d/nginx

[[email protected] application]# chmod +x /etc/init.d/nginx

[[email protected] application]# /etc/init.d/nginx start

chown: missing operand after `/data/application/nginx/tmp/client‘
Try `chown --help‘ for more information.
chown: missing operand after `/data/application/nginx/tmp/proxy/‘
Try `chown --help‘ for more information.
chown: missing operand after `/data/application/nginx/tmp/fcgi‘
Try `chown --help‘ for more information.
chown: missing operand after `/data/application/nginx/tmp/uwsgi‘
Try `chown --help‘ for more information.
chown: missing operand after `/data/application/nginx/tmp/scgi‘
Try `chown --help‘ for more information.
Starting nginx:                                            [  OK  ]

解决报错

[[email protected] application]# chown  www.www nginx/* –R

[[email protected] application]# /etc/init.d/nginx restart  
nginx: the configuration file /data/application/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /data/application/nginx/conf/nginx.conf test is successful
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

时间: 2024-12-12 21:38:30

安装zabbix 编译lnmp环境的相关文章

ubuntu 14.10安装zabbix(lnmp环境)

今天折腾了好一阵,终于在lnmp环境下装好了zabbix.激动的我眼泪都流出来几滴,总结一下碰到的问题 安装 lnmp环境和zabbix的过程我就不多说,网上很多,我就是参照: https://github.com/itnihao/zabbix-book/blob/master/03-chapter/zabbix_install_on_ubuntu.md 不过上面介绍的是lamp环境下安装zabbix.其实也没差多少,就是将apache换成nginx(为apt-get安装).但问题往往就出现在这

Centos7 安装Zabbix (LNMP环境)

环境包安装: yum install -y autoconf make automake imake cmake gcc gcc-c++ libaio libaio-devel bzr bison expat-devel libtool ncurses5-devel gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel yum install pcre* yum install openssl* y

手工编译lnmp环境

同步时间:ntpdate 202.120.2.101(上海交大ntp服务器) 使用ntsysv --level 2345,关闭非必要程序自动运行. 修改/etc/sysconfig/i18n文件内容为:LANG="zh_CN:gb2312" 源码放在/usr/local //创建用户及站点目录并更改权限 groupadd www useradd -r -g www -s /sbin/nologin www groupadd mysql useradd -r -g  mysql mysq

源码编译LNMP环境

  一.环境准备: 1.部署LNMP架构需要安装依赖包 yum -y install make gcc gcc-c++ flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel gd freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2

CentOS 7源码安装最新版LNMP环境

由于公司要求需要最新版的ZABBIX2.4.4需要最新版的系统CENTOS7和最新版的LNMP环境,所以本人摸索着使用最新版的环境搭建了LNMP系统,环境版本如下: 系统:CentOS 7 x86_64 NGINX:nginx-1.7.12 数据库:mariadb-10.0.13 PHP:php-5.5.23 首先做一些准备工作,先把centos7的防火墙更换成iptables,可以参见如下链接 centos7防火墙改为iptables 修改成iptables之后就可以清空iptables里面的

终于完成了 源码 编译lnmp环境

经过了大概一个星期的努力,终于按照海生的编译流程将lnmp环境源码安装出来了 nginx 和php 主要参考 http://hessian.cn/p/1273.html mysql 主要参考 http://blog.csdn.net/superchanon/article/details/8546254/ 文章中有的就不在赘述了 mysql 注意: *如果mysql的安装目录(解压目录)不是/usr/local/mysql,那么还必须指定目录参数,如 (下面改成我需要的路径) [[email p

安装zabbix及LNMP的平台的搭建

Zabbix3.0.3安装文档 环境rhel 5.8 IP:192.168.0.8 需要安装: Nginx Php Mysql Zabbix 安装步骤: 一 .  Nginx1.6安装 安装nginx前要先安装pcre(支持正则表达式),最好也安装一下openssl(可以支持安全协议的站点) [[email protected] tmp]# tar zxvf pcre-8.35.tar.gz [[email protected] pcre-8.35]# ./configure [[email p

Zabbix部署-LNMP环境

参考文档: LNMP安装:http://www.osyunwei.com/archives/7891.html 一.环境 Server:CentOS-7-x86_64-1511 Client:Win7 x86_64, Chrome/Firefox浏览器 二.准备 1. iptables CentOS7默认自带firewall,无iptables. [[email protected] ~]# systemctl stop firewalld.service #停止firewall [[email

自动安装lamp和lnmp环境

#!/bin/bash echo "It will install lamp or lnmp." sleep 1 ##check last command is OK or not. check_ok() { if [ $? != 0 ] then     echo "Error, Check the error log."     exit 1 fi } ##get the archive of the system,i686 or x86_64. ar=`arc