nginx编译安装
来源:互联网 发布:oracle云计算平台实战 编辑:程序博客网 时间:2024/06/02 16:04
1、安装依赖:yum -y install gcc-c++ pcre-devel zlib-devel
2、下载nginx:wget http://nginx.org/download/nginx-1.11.6.tar.gz
3、解压:tar -zxvf nginx-1.11.6.tar.gz
4、进入nginx安装文件:cd nginx-1.11.6
5、配置:./configure --prefix=/usr/local/nginx --pid-path=/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-stream
6、编译安装 :make && make install
7、在/etc/init.d/ 目录下编辑nginx启动脚本,脚本如下
#!/bin/bash# nginx Startup script for the Nginx HTTP Server# it is v.0.0.2 version.# chkconfig: - 85 15# description: Nginx is a high-performance web and proxy server.# It has a lot of features, but it's not for everyone.# processname: nginx# pidfile: /var/run/nginx.pid# config: /usr/local/nginx/conf/nginx.confnginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confnginx_pid=/run/nginx.pidRETVAL=0prog="nginx"# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ ${NETWORKING} = "no" ] && exit 0[ -x $nginxd ] || exit 0# Start nginx daemons functions.start() {if [ -e $nginx_pid ];then echo "nginx already running...." exit 1fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL}# Stop nginx daemons functions.stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid}# reload nginx service functions.reload() { echo -n $"Reloading $prog: " #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo}# See how we were called.case "$1" instart) start ;;stop) stop ;;reload) reload ;;restart) stop start ;;status) status $prog RETVAL=$? ;;*) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1esacexit $RETVAL
一定要赋权 chmod 777 nginx
8、设置开机自启如下:在/etc/rc.local 文件中加入 :/etc/init.d/nginx start
赋权:chmod +x /etc/rc.local
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 编译安装
- 9. JavaScript 事件参考手册
- hiho一下58周
- linux下动态库so文件的一些认识
- 配置Vim——自动缩进(C/C++)
- 如何获取Manifest中<meta-data>的值
- nginx编译安装
- 坐标系统详解
- Shell的集中输出文件方式
- UNIX网络编程卷一:第二十一章 多播
- 戦後60年の小泉談話全文 2005年8月15日
- chrome插件 时空隧道
- Hybrid App:借助HTML5、JavaScript和CSS3开发
- 为什么Scrum不行?
- svn merge branch