yum -y install pcre-devel.x86_64
yum -y install openssl openssl-devel.x86_64
useradd www -s /sbin/nologin
wget http://nginx.org/download/nginx-1.12.2.tar.gz tar zxf nginx-1.12.2.tar.gz
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/logs/nginx.pid --lock-path=/usr/local/nginx/logs/nginx.lock --http-client-body-temp-path=/usr/local/nginx/cache/client_temp --http-proxy-temp-path=/usr/local/nginx/cache/proxy_temp --http-fastcgi-temp-path=/usr/local/nginx/cache/fastcgi_temp --http-uwsgi-temp-path=/usr/local/nginx/cache/uwsgi_temp --http-scgi-temp-path=/usr/local/nginx/cache/scgi_temp --user=www --group=www --with-pcre --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_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_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_auth_request_module --with-file-aio
make && make install chmod +x /etc/init.d/nginx
/etc/init.d/nginx status
#!/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: /usr/local/nginx/conf/nginx.conf
# config: /etc/sysconfig/nginx
# 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 0 nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/usr/local/nginx/logs/nginx.lock 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

  

[运维笔记] Nginx编译安装的更多相关文章

  1. 运维笔记-----nginx反向代理

    在/opt/nginx 下的配置文件同级建立反向代理的配置文件manager.conf <span style="font-size:18px;">user nobod ...

  2. 运维笔记--Ubuntu离线安装jdk1.8(JDK8)Java环境

    Ubuntu离线环境安装jdk1.8 系统版本:Ubuntu16.04 其他Ubuntu版本安装类似 Jdk版本:8 1. 下载相应离线软件包 Jdk oracle官方下载地址:https://www ...

  3. Linux系统运维笔记(四),CentOS 6.4安装Nginx

    Linux系统运维笔记(四),CentOS 6.4安装Nginx 1,安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool op ...

  4. Linux系统运维笔记(五),CentOS 6.4安装java程序

    Linux系统运维笔记(五),CentOS 6.4安装java程序 用eclipse编译通的java程序,现需要实施到服务器.实施步骤: 一,导出程序成jar包. 1,在主类编辑界面点右健,选  ru ...

  5. Linux系统运维笔记(四),CentOS 6.4安装 MongoDB

    Linux系统运维笔记(四),CentOS 6.4安装 MongoDB 1,下载 https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6 ...

  6. Linux系统运维笔记(一),查看系统版本和设置系统时间

    Linux系统运维笔记 查看系统版本和设置系统时间 查看系统版本 lsb_release -a (适用于所有的linux,包括Redhat.SuSE.Debian等发行版,但是在debian下要安装l ...

  7. Nginx编译安装第三方模块http_substitutions_filter_module

    Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术  作者:rming  时间:-- . >>ngx_http_substitu ...

  8. nginx编译安装

    Nginx编译安装 1.nginx官网:http://wiki.nginx.org/Install下载:http://nginx.org/en/download.html 2.编译安装# wget h ...

  9. LNMP平台搭建之一:nginx编译安装

    参考博客:https://www.cnblogs.com/zhang-shijie/p/5294162.html   jack.zhang 一.环境说明 系统环境:centos6.5 [root@lo ...

随机推荐

  1. 十五、curator recipes之DistributedQueue

    简介 curator实现了先入先出的分布式消息队列,它采用的是zookeeper的持久化有序节点. 官方文档:http://curator.apache.org/curator-recipes/dis ...

  2. 腾讯企业邮箱报错 "smtp.exmail.qq.com"port 465, isSSL false

    一.报错 "smtp.exmail.qq.com" port 465, isSSL false 通过网上搜索查询一些资料,推测是邮箱的配置出问题了. 二.修改邮箱配置 // 创建属 ...

  3. bnu 被诅咒的代码

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=10792 被诅咒的代码 Time Limit: 1000ms Memory Limit: 65536K ...

  4. #if, #elif, #else, #endif 使用

    程序想要通过简单地设置一些参数就生成一个不同的软件,在不同的情况下可能只用到一部分代码,就没必要把所有的代码都写进去,就可以用条件编译,通过预编译指令设置编译条件,在不同的需要时编译不同的代码. (一 ...

  5. .NET Core是什么

    对于开发人员,把C#语言和.NET描述为最重要的新技术一点都不夸张.NET提供了一种环境.在这种环境中,可以开发在Windows上运行的几乎所有应用程序.如:编写Web页面.WPF应用程序.REST ...

  6. css 样式加载次序

    一般而言,所有的样式会根据下面的规则层叠于一个新的虚拟样式表中,其中数字 4 拥有最高的优先权(本人理解为:先加载1的样式,然后用2的样式覆盖1中的样式,3.4同理) 浏览器缺省设置(浏览器默认的样式 ...

  7. window.addEventListener绑定事件记得删除

    在做postMessage通信时,window.addEventListener绑定的事件记得要remove掉 就和setTime一样,不然占用内存资源

  8. JavaScript的进阶之路(五)理解数组2

    数组方法 //定义一个测试数组 var array1 = [1,2,5,null,"a"]; //join()方法是String.split()方法的逆操作,后者是将字符串分割成若 ...

  9. How To Secure Apache with Let's Encrypt on Ubuntu (Free SSL)

    Introduction This tutorial will show you how to set up a TLS/SSL certificate from Let's Encrypt on a ...

  10. C++11 之for 新解 auto

    C++11 之for 新解 auto  前言    C++11这次的更新带来了令很多C++程序员期待已久的for range循环,每次看到javascript, lua里的for range,心想要是 ...