Nginx编译安装
来源:互联网 发布:淘宝上的大拿韩代 编辑:程序博客网 时间:2024/06/05 23:33
标签(空格分隔): nginx
1 添加运行nginx服务进程的用户
# groupadd -r nginx# useradd -r -g nginx nginx
2 安装依赖
yum groupinstall "Development tools"yum -y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
3 下载源码
wget http://nginx.org/download/nginx-1.10.2.tar.gz
4 下载 echo 模块
git clone https://github.com/openresty/echo-nginx-module.git
5 解包源码
tar xvf nginx-1.10.2.tar.gz -C /usr/local/srccp -a echo-nginx-module /usr/local/src/
6 编译安装
cd /usr/local/src/nginx-1.10.2./configure \--prefix=/usr/local/nginx \--lock-path=/usr/local/nginx/logs/nginx.lock \--http-client-body-temp-path=/usr/local/nginx/tmp/client \--http-proxy-temp-path=/usr/local/nginx/tmp/proxy \--http-fastcgi-temp-path=/usr/local/nginx/tmp/fcgi \--http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi \--http-scgi-temp-path=/usr/local/nginx/tmp/scgi \--user=nginx \--group=nginx \--with-pcre \--with-http_v2_module \--with-http_ssl_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_stub_status_module \--with-http_auth_request_module \--with-mail \--with-mail_ssl_module \--with-file-aio \--with-http_v2_module \--with-threads \--with-stream \--with-stream_ssl_module \--add-module=/usr/local/src/echo-nginx-modulemake && make install
7 添加SysV启动脚本。
# vim /etc/init.d/nginx#!/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 0nginx="/usr/local/nginx/sbin/nginx"prog=$(basename $nginx)NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginxlockfile=/usr/local/nginx/logs/nginx.lockstart() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 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 killall -9 nginx}restart() { configtest || return $? stop sleep 1 start}reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUPRETVAL=$? 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 2esac
8 赋予脚本执行权限。
# chmod +x /etc/init.d/nginx
9 添加至服务管理列表,设置开机自启。
# chkconfig --add nginx# chkconfig nginx on
10 启动服务。
# service nginx start
11 浏览器访问可看到默认欢迎页面
阅读全文
0 0
- 编译安装nginx [Ubuntu]
- ubuntu 编译安装nginx
- 手工编译安装nginx
- nginx编译安装
- 编译安装nginx
- CentOS6编译安装Nginx
- 编译安装Nginx
- nginx 编译安装
- mac编译安装nginx
- Nginx的编译安装
- 编译安装nginx
- nginx---编译安装
- 编译安装Nginx
- NGINX编译安装
- Nginx编译安装
- ubuntu 编译安装 nginx
- 编译安装Nginx
- Nginx + php 编译安装
- Python数据挖掘入门与实践(四)——亲和性分析
- js rowspan
- ubuntu使用shadowsocks-qt5代理
- Codeforces Round #335 (Div. 2)-C Sorting Railway Cars(最长上升子序列)
- Hdu 4035 Maze 树上概率DP
- Nginx编译安装
- 网络犯罪溯源分享·
- JDBC 使用说明
- java的多态-简单理解
- 简单了解python装饰器
- mysql 系统错误5
- 【python小练】图片爬虫之BeautifulSoup4--转自博客园
- iOS 简单粗暴的浅谈类与对象
- 输出所有的水仙花数。