linux下安装nginx
2014-09-23 11:14
246 查看
nginx是一款轻量级,很强大的http服务器,经常被用于负载均衡。现在简单说明在linux如何安装nginx
nginx下载解压
http:nginx.org 下载
nginx依赖包
pcre
openssl
gzip
进行在线升级
nginx安装
指定安装路径为 /usr/local/nginx
nginx自启动脚本
nginx测试
输入http:ip 如果显示welcome nginx ,说明安装成功
nginx下载解压
http:nginx.org 下载
nginx依赖包
pcre
openssl
gzip
进行在线升级
yum -y install pcre-devel; yum -y install openssl; yum -y install openssl-devel;
nginx安装
指定安装路径为 /usr/local/nginx
./configure --prefix=/usr/local/nginx make make install make clean
nginx自启动脚本
#!/bin/bash nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/logs/nginx.pid RETVAL=0 prog="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 1 fi 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" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL
nginx测试
输入http:ip 如果显示welcome nginx ,说明安装成功
相关文章推荐
- Linux下nginx的安装
- linux 下nginx安装与配置
- Linux下的Nginx安装(开机自启动)
- LNMP一键安装Linux系统下Nginx+MySQL+PHP这种网站服务器架构
- 【Linux】Nginx安装、部署--CentOS5.4
- LNMP-Linux下Nginx+PHP+MySQL+phpMyAdmin+eAcelerator一键安装包
- LNMP-Linux下Nginx+MySQL+PHP+phpMyAdmin+eAcelerator一键安装包(2011年2月8日更新)
- nginx-linux安装说明
- linux 下 Nginx 0.8.40的安装
- Linux 编译安装Nginx 配置 Python FastCGI Django (3) 配置nginx和django
- linux 下 nginx 安装 配置
- LNMP一键安装包 0.5 正式发布(Linux+Nginx+Mysql+PHP)
- Linux 编译安装Nginx 配置 Python FastCGI Django (1) 编译安装nginx
- LNMP-Linux下Nginx+MySQL+PHP+phpMyAdmin+eAcelerator一键安装包(2009年11月17日更新)
- Linux环境下nginx的安装
- Linux下nginx的安装问题
- linux 下安装nginx经常出现 make[2]: Leaving directory `/usr/local/ssl' 或make[2]: Leaving directory `/usr/local/openssl' 找不到的情况解决方法
- nginx 0.6.3 安装与配置(linux,nginx,php-cgi)
- Linux下怎么确定Nginx安装目录
- linux下怎么安装nginx