1. 安装Nginx
  2.  
  3. 、安装pcre
  4.  
  5. cd /usr/local/src
  6.  
  7. mkdir /usr/local/pcre
  8.  
  9. tar zxvf pcre-8.36.tar.gz
  10.  
  11. cd pcre-8.36
  12.  
  13. ./configure --prefix=/usr/local/pcre
  14.  
  15. make && make install
  16.  
  17. 、安装openssl
  18.  
  19. cd /usr/local/src
  20.  
  21. mkdir /usr/local/openssl
  22.  
  23. tar zxvf openssl-1.0.1h.tar.gz
  24.  
  25. cd openssl-1.0.1h
  26.  
  27. ./config --prefix=/usr/local/openssl
  28.  
  29. make && make install
  30.  
  31. vi /etc/profile
  32.  
  33. export PATH=$PATH:/usr/local/openssl/bin
  34.  
  35. :wq!
  36.  
  37. source /etc/profile
  38.  
  39. 、安装zlib
  40.  
  41. cd /usr/local/src
  42.  
  43. mkdir /usr/local/zlib
  44.  
  45. tar zxvf zlib-1.2..tar.gz
  46.  
  47. cd zlib-1.2.
  48.  
  49. ./configure --prefix=/usr/local/zlib
  50.  
  51. make && make install
  52.  
  53. 、安装Nginx
  54.  
  55. groupadd www
  56.  
  57. useradd -g www www -s /bin/false
  58.  
  59. cd /usr/local/src
  60.  
  61. tar zxvf nginx-1.8..tar.gz
  62.  
  63. cd nginx-1.8.
  64.  
  65. mkdir -p /export/servers/nginx
  66.  
  67. ./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
  68.  
  69. 注意:--with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2. --with-pcre=/usr/local/src/pcre-.36指向的是源码包解压的路径,而不是安装的路径,否则会报错
  70.  
  71. make && make install
  72.  
  73. /export/servers/nginx/sbin/nginx #启动Nginx
  74.  
  75. 设置nginx开机启动
  76.  
  77. vi /etc/rc.d/init.d/nginx #编辑启动文件添加下面内容
  78.  
  79. ############################################################
  80.  
  81. #!/bin/sh
  82.  
  83. #
  84.  
  85. # nginx - this script starts and stops the nginx daemon
  86.  
  87. #
  88.  
  89. # chkconfig: -
  90.  
  91. # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
  92.  
  93. # proxy and IMAP/POP3 proxy server
  94.  
  95. # processname: nginx
  96.  
  97. # config: /etc/nginx/nginx.conf
  98.  
  99. # config: /usr/local/nginx/conf/nginx.conf
  100.  
  101. # pidfile: /usr/local/nginx/logs/nginx.pid
  102.  
  103. # Source function library.
  104.  
  105. . /etc/rc.d/init.d/functions
  106.  
  107. # Source networking configuration.
  108.  
  109. . /etc/sysconfig/network
  110.  
  111. # Check that networking is up.
  112.  
  113. [ "$NETWORKING" = "no" ] && exit
  114.  
  115. nginx="/export/servers/nginx/sbin/nginx"
  116.  
  117. prog=$(basename $nginx)
  118.  
  119. NGINX_CONF_FILE="/export/servers/nginx/conf/nginx.conf"
  120.  
  121. [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
  122.  
  123. lockfile=/var/lock/subsys/nginx
  124.  
  125. make_dirs() {
  126.  
  127. # make required directories
  128.  
  129. user=`$nginx -V >& | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
  130.  
  131. if [ -z "`grep $user /etc/passwd`" ]; then
  132.  
  133. useradd -M -s /bin/nologin $user
  134.  
  135. fi
  136.  
  137. options=`$nginx -V >& | grep 'configure arguments:'`
  138.  
  139. for opt in $options; do
  140.  
  141. if [ `echo $opt | grep '.*-temp-path'` ]; then
  142.  
  143. value=`echo $opt | cut -d "=" -f `
  144.  
  145. if [ ! -d "$value" ]; then
  146.  
  147. # echo "creating" $value
  148.  
  149. mkdir -p $value && chown -R $user $value
  150.  
  151. fi
  152.  
  153. fi
  154.  
  155. done
  156.  
  157. }
  158.  
  159. start() {
  160.  
  161. [ -x $nginx ] || exit
  162.  
  163. [ -f $NGINX_CONF_FILE ] || exit
  164.  
  165. make_dirs
  166.  
  167. echo -n $"Starting $prog: "
  168.  
  169. daemon $nginx -c $NGINX_CONF_FILE
  170.  
  171. retval=$?
  172.  
  173. echo
  174.  
  175. [ $retval -eq ] && touch $lockfile
  176.  
  177. return $retval
  178.  
  179. }
  180.  
  181. stop() {
  182.  
  183. echo -n $"Stopping $prog: "
  184.  
  185. killproc $prog -QUIT
  186.  
  187. retval=$?
  188.  
  189. echo
  190.  
  191. [ $retval -eq ] && rm -f $lockfile
  192.  
  193. return $retval
  194.  
  195. }
  196.  
  197. restart() {
  198.  
  199. #configtest || return $?
  200.  
  201. stop
  202.  
  203. sleep
  204.  
  205. start
  206.  
  207. }
  208.  
  209. reload() {
  210.  
  211. #configtest || return $?
  212.  
  213. echo -n $"Reloading $prog: "
  214.  
  215. killproc $nginx -HUP
  216.  
  217. RETVAL=$?
  218.  
  219. echo
  220.  
  221. }
  222.  
  223. force_reload() {
  224.  
  225. restart
  226.  
  227. }
  228.  
  229. configtest() {
  230.  
  231. $nginx -t -c $NGINX_CONF_FILE
  232.  
  233. }
  234.  
  235. rh_status() {
  236.  
  237. status $prog
  238.  
  239. }
  240.  
  241. rh_status_q() {
  242.  
  243. rh_status >/dev/null >&
  244.  
  245. }
  246.  
  247. case "$1" in
  248.  
  249. start)
  250.  
  251. rh_status_q && exit
  252.  
  253. $
  254.  
  255. ;;
  256.  
  257. stop)
  258.  
  259. rh_status_q || exit
  260.  
  261. $
  262.  
  263. ;;
  264.  
  265. restart|configtest)
  266.  
  267. $
  268.  
  269. ;;
  270.  
  271. reload)
  272.  
  273. rh_status_q || exit
  274.  
  275. $
  276.  
  277. ;;
  278.  
  279. force-reload)
  280.  
  281. force_reload
  282.  
  283. ;;
  284.  
  285. status)
  286.  
  287. rh_status
  288.  
  289. ;;
  290.  
  291. condrestart|try-restart)
  292.  
  293. rh_status_q || exit
  294.  
  295. ;;
  296.  
  297. *)
  298.  
  299. echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
  300.  
  301. exit
  302.  
  303. esac
  304.  
  305. ############################################################
  306.  
  307. :wq! #保存退出
  308.  
  309. chmod /etc/rc.d/init.d/nginx #赋予文件执行权限
  310.  
  311. chkconfig nginx on #设置开机启动
  312.  
  313. /etc/rc.d/init.d/nginx restart #重启
  314.  
  315. 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. dubbo总结

     一 .Dubbo产生背景 单一应用架构当网站流量很小时,只需一个应用,将所有功能都部署在一起,以减少部署节点和成本.此时,用于简化增删改查工作量的 数据访问框架(ORM) 是关键. 垂直应用架构当访 ...

  2. 【android】 如何把gif图片下载到本地

    以上图片大家可以看到,虽然是个jpg格式的文件,但是本质上是个动图. 但是发现在咱的图片模块下,本地存储的图片只有一帧,问题出在哪里呢? http获取到的byte[]数据是没问题的 断点跟踪了下,发现 ...

  3. 对Java ConcurrentHashMap的一些了解

    ①引言(为什么要使用ConcurrentHashMap) 因为多线程环境下,使用Hashmap进行put操作会引起死循环,导致CPU利用率接近100%,所以在并发情况下不能使用HashMap. Has ...

  4. 防止常见XSS 过滤 SQL注入 JAVA过滤器filter

    XSS : 跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS.恶意攻击者往W ...

  5. 对称加密与非对称加密,以及RSA的原理

    一 , 概述 在现代密码学诞生以前,就已经有很多的加密方法了.例如,最古老的斯巴达加密棒,广泛应用于公元前7世纪的古希腊.16世纪意大利数学家卡尔达诺发明的栅格密码,基于单表代换的凯撒密码.猪圈密码, ...

  6. httpd sshd firewalld 很多服务后面的d是什么意思

    在操作系统中,一般系统的服务都是以后台进程的方式存在,而且都会常驻系统中,直到关机才结束.这类服务也称Daemon,在Linux系统中就包含许多的Daemon. 判断Daemon最简单的方法就是从名称 ...

  7. Camera帧率和AE的关系

    1.camera首先是通过曝光的pixel加上dummy pixel以及曝光的line加上dummy line来决定一帧的曝光时间,这一帧曝光时间的倒数就是帧率,这个没有错吧,但是看代码时候看到pre ...

  8. CSS 布局 - 水平 & 垂直对齐

    CSS 布局 - 水平 & 垂直对齐 一.元素居中对齐 要水平居中对齐一个元素(如 <div>), 可以使用 margin: auto;. 设置到元素的宽度将防止它溢出到容器的边缘 ...

  9. CentOS 7配置静态IP地址

    [root@centos1 ~]# ifconfig -bash: ifconfig: command not found 首先,习惯性的输入echo $PATH(查看当前PATH环境变量,跟DOS的 ...

  10. mysql中一张(居民)表按年龄段查询数据

    知识点: 用mysql,按年龄段查询一张居民的数据(各年龄段居民的个数) 1.如:查询resident(居民表),按照各年龄段,统计人数 2.mysql语句如下: select ageproporti ...