安装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. 修改WordPress标签云字体大小颜色及标签显示数量

    WordPress 自带的标签云是一个很实用的小工具.站长可以通过标签对具有相同关健词的文章进行检索分类,利于访客查找相关文章.WordPress 默认标签云的字体最小为8pt,最大为22pt,标签显 ...

  2. java初学一

    1.区分大小写 public static void main String args[]  是类体中的一个方法,之后的两个大括号以及之间的内容叫做方法体,一个java应用程序中必须有一个类且只有一个 ...

  3. PKU 2559 Largest Rectangle in a Histogram(单调栈)

    题目大意:原题链接 一排紧密相连的矩形,求能构成的最大矩形面积. 为了防止栈为空,所以提前加入元素(-1,0) #include<cstdio> #include<stack> ...

  4. hdu5716

    地址: 题目: 带可选字符的多字符串匹配 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  5. TCP/IP原理简述

    TCP/IP与OSI TCP/IP工作在第4层,在TCP/IP协议簇中,有两个不同的传输协议:TCP(传输控制协议)和UDP(用户数据报协议),它们分别承载不同的应用.TCP协议提供可靠的服务,UDP ...

  6. 20145301实验五 Java网络编程及安全

    北京电子科技学院(BESTI)实验报告 课程:Java程序设计 班级:1453 指导教师:娄嘉鹏 实验日期:2016.05.06 18:30-21:30 实验名称:实验五 Java网络编程 实验内容 ...

  7. delegate委托

    https://www.cnblogs.com/leicao/p/5251090.html 委托是一种存储函数引用的类型,在事件和事件的处理时有重要的用途 通俗的说,委托是一个可以引用方法的类型,当创 ...

  8. zip unzip tar 压缩解压

    yum install -y unzip zip    yum安装zip -r mydata.zip mydata    mydata目录压缩为mydata.zipunzip mydata.zip - ...

  9. 使用淘宝的npm代理下载模块

    npm install node-sass --registry=http://registry.npm.taobao.org

  10. Python 实现C语言 while(scanf("%d%d", &a, &b) != EOF) 语句功能

    reference:Python 实现C语言 while(scanf("%d%d", &a, &b) != EOF) 语句功能 在python中,无法通过input ...