安装Nginx

 、安装pcre

 cd /usr/local/src

 mkdir /usr/local/pcre

 tar zxvf pcre-8.36.tar.gz

 cd pcre-8.36

 ./configure --prefix=/usr/local/pcre

 make && make install

 、安装openssl

 cd /usr/local/src

 mkdir /usr/local/openssl

 tar zxvf openssl-1.0.1h.tar.gz

 cd openssl-1.0.1h

 ./config --prefix=/usr/local/openssl

 make && make install

 vi /etc/profile

 export PATH=$PATH:/usr/local/openssl/bin

 :wq!

 source /etc/profile

 、安装zlib

 cd /usr/local/src

 mkdir /usr/local/zlib

 tar zxvf zlib-1.2..tar.gz

 cd zlib-1.2.

 ./configure --prefix=/usr/local/zlib

 make && make install

 、安装Nginx

 groupadd www

 useradd -g www www -s /bin/false

 cd /usr/local/src

 tar zxvf nginx-1.8..tar.gz

 cd nginx-1.8.

 mkdir -p /export/servers/nginx

 ./configure --prefix=/export/servers/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2. --with-pcre=/usr/local/src/pcre-8.36

 注意:--with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2. --with-pcre=/usr/local/src/pcre-.36指向的是源码包解压的路径,而不是安装的路径,否则会报错

 make && make install

 /export/servers/nginx/sbin/nginx #启动Nginx

 设置nginx开机启动

 vi /etc/rc.d/init.d/nginx  #编辑启动文件添加下面内容

 ############################################################

 #!/bin/sh

 #

 # nginx - this script starts and stops the nginx daemon

 #

 # chkconfig: -  

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

 # proxy and IMAP/POP3 proxy server

 # processname: nginx

 # config: /etc/nginx/nginx.conf

 # config: /usr/local/nginx/conf/nginx.conf

 # pidfile: /usr/local/nginx/logs/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 

 nginx="/export/servers/nginx/sbin/nginx"

 prog=$(basename $nginx)

 NGINX_CONF_FILE="/export/servers/nginx/conf/nginx.conf"

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

 lockfile=/var/lock/subsys/nginx

 make_dirs() {

 # make required directories

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

 if [ -z "`grep $user /etc/passwd`" ]; then

 useradd -M -s /bin/nologin $user

 fi

 options=`$nginx -V >& | grep 'configure arguments:'`

 for opt in $options; do

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

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

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

 # echo "creating" $value

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

 fi

 fi

 done

 }

 start() {

 [ -x $nginx ] || exit 

 [ -f $NGINX_CONF_FILE ] || exit 

 make_dirs

 echo -n $"Starting $prog: "

 daemon $nginx -c $NGINX_CONF_FILE

 retval=$?

 echo

 [ $retval -eq  ] && touch $lockfile

 return $retval

 }

 stop() {

 echo -n $"Stopping $prog: "

 killproc $prog -QUIT

 retval=$?

 echo

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

 return $retval

 }

 restart() {

 #configtest || return $?

 stop

 sleep 

 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 >&

 }

 case "$1" in

 start)

 rh_status_q && exit 

 $

 ;;

 stop)

 rh_status_q || exit 

 $

 ;;

 restart|configtest)

 $

 ;;

 reload)

 rh_status_q || exit 

 $

 ;;

 force-reload)

 force_reload

 ;;

 status)

 rh_status

 ;;

 condrestart|try-restart)

 rh_status_q || exit 

 ;;

 *)

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

 exit 

 esac

 ############################################################

 :wq! #保存退出

 chmod  /etc/rc.d/init.d/nginx #赋予文件执行权限

 chkconfig nginx on #设置开机启动

 /etc/rc.d/init.d/nginx restart #重启

 log_format custom_log '[$status] || $time_local || $remote_addr || $http_x_forwarded_for || $request || $query_string || $body_bytes_sent || $http_referer || $request_time || $http_user_agent || $http_cookie || $host || up_addr:$upstream_addr || up_resp:$upstream_response_time || up_status:$upstream_status || $server_addr ';

gomefinance

Nginx1.8 安装说明的更多相关文章

  1. nginx1.8安装nginx_concat_module及400错误解决办法

    nginx安装concat模块可以合并js,css等静态资源,减少http请求 在nginx源码目录执行命令: ./configure --user=www --group=www --prefix= ...

  2. [原创] zabbix学习之旅一:源码安装

    zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统管理员快速定位/解决存 ...

  3. linux下安装nginx与配置

    linux系统为Centos 64位 第一步:从http://nginx.org/download/上下载相应的版本(或者wget http://nginx.org/download/nginx-1. ...

  4. 运用Zabbix实现内网服务器状态及局域网状况监控(3) —— Zabbix服务端安装

    1. Zabbix服务端安装,基于LNMP PHP5.5+Nginx1.9安装配置:http://www.cnblogs.com/vurtne-lu/p/7707536.html MySQL5.5编译 ...

  5. Nginx(一):linux下安装nginx与配置

    linux系统为Centos 64位 准备目录 [root@instance-3lm099to ~]# mkdir /usr/local/nginx [root@instance-3lm099to ~ ...

  6. 编译安装php、nginx

    以centos6.6为例 1.安装以及配置php 首先在官网下载源码包http://php.net/downloads.php 这里下载php-7.1.16 .tar.gzcd php-7.1.16 ...

  7. 在linux系统下安装两个nginx以及启动、停止、重起

    如果没有安装过nginx请看:linux下nginx部署以及配置详解 1.第一个nginx已经安装完成后,现在安装第二个nginx 启动:sudo /usr/sbin/nginx3 重起:sudo / ...

  8. yum 快速LAMP/LNMP 安装(centos7+mysql5.7+apache+php5.6 (缺点:好多模块没有加载)

    1.安装Apache 安装centos7默认自带(Apache2.4.6)版本 yum -y install httpd 2.开启apache服务 systemctl start httpd.serv ...

  9. Centos7架设NMP服务器笔记

    安装centos7.3 1.从mirrors.163.com下载7.3 2.准备虚拟机vitualbox,网络我使用的桥接到无线网卡,直接连我到路由器,IP自动分配(本来想搞静态IP的,搞了好久没成功 ...

随机推荐

  1. python16_day19【Django_抽屉项目】

    补充ORM块: 1.select_related()  # 解决:当有外健,规避多决查询,使用了join. 多次查询变成一次查询 例:UserInfo.objects.all().select_rel ...

  2. MySQL 温故知心(三)

    MySQL锁概述 相对其他数据库而言,MySQL的锁机制比较简单,其最显著的特点是不同的存储引擎支持不同的锁机制.比如,MyISAM和MEMORY存储引擎采用的是表级锁(table-level loc ...

  3. 学习Android开发看那些书好?

    学习一样新事物或许有多种方式,报培训班,看视频,向高手请教等等,但一本好书往往可以让你少走很多弯路,事半功倍. 下面推荐几本个人觉得搞Android开发值得一读的书籍. Head First Java ...

  4. hdu4057 Rescue the Rabbit

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=4057 题目: Rescue the Rabbit Time Limit: 20000/10000 MS ( ...

  5. 2017 Multi-University Training Contest - Team 4 hdu6069 Counting Divisors

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6069 题目: Counting Divisors Time Limit: 10000/5000 ...

  6. java泛型的实现原理

    java泛型的实现原理是类型擦除.Java的泛型是伪泛型.在编译期间,所有的泛型信息都会被擦除掉.   Java中的泛型基本上都是在编译器这个层次来实现的.在生成的Java字节码中是不包含泛型中的类型 ...

  7. UI自动化测试框架之Selenium关键字驱动 (转)

    摘要 自动化测试框架demo,用关键字的形式将测试逻辑封装在数据文件中,测试工具解释这些关键字即可对其应用自动化 一.原理及特点 1.   关键字驱动测试是数据驱动测试的一种改进类型 2.    主要 ...

  8. mybatis-3 Dynamic SQL

    Dynamic SQL One of the most powerful features of MyBatis has always been its Dynamic SQL capabilitie ...

  9. java.lang.ClassFormatError: Trjava.lang.ClassFormatError: Truncated class fileuncated class file

    周末过来加班,上传编译好的文件后,部署到服务器没事.但是服务器日志满了,把日志清除后,把服务启动,发现报这个错误,大致网上看了一下,这个错误是编译的文件损坏了.然后大致看了一下文件,还真是.由于日志满 ...

  10. Linux入门之--Linux文件系统结构

    对于每一个Linux学习者来说,了解Linux文件系统的目录结构,是学好Linux的至关重要的一步.,深入了解linux文件目录结构的标准和每个目录的详细功能,对于我们用好linux系统只管重要,下面 ...