nginx 快速搭建
2015-11-18 17:39
387 查看
1. 下载稳定版1.8,及其它依赖包
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1m.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
2. 编辑可执行文件 并运行
#!/bin/bash
groupadd -g600 nginx
useradd -u600 -g600 nginx
user=nginx # change to user who run nginx
dir_prefix=/home/deploy/nginx #定义安装目录
script_path=`readlink -f $0`
script_dir=`dirname $script_path`
opath=`pwd`
yum install -y gd-devel pcre-devel libgcrypt-devel libxml2-devel libxslt-devel GeoIP-devel
tar zxvf $script_dir/zlib-1.2.8.tar.gz -C $script_dir
tar zxvf $script_dir/openssl-1.0.1m.tar.gz -C $script_dir
tar zxvf $script_dir/nginx-1.8.0.tar.gz -C $script_dir
cd $script_dir/nginx-1.8.0
./configure --prefix=$dir_prefix --user=$user --group=$user --http-log-path=$dir_prefix/log/access.log --error-log-path=$dir_prefix/log/error.log --pid-path=$dir_prefix/pid/nginx.pid
--lock-path=$dir_prefix/lock/nginx.lock --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_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_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-pcre --with-zlib=$script_dir/zlib-1.2.8
--with-openssl=$script_dir/openssl-1.0.1m
make
make install
mkdir -p $dir_prefix/sites-enabled
mkdir -p $dir_prefix/lock
\cp -f $script_dir/etc.initd.nginx-$user /etc/init.d/nginx-$user
\cp -f $script_dir/conf.nginx.conf $dir_prefix/conf/nginx.conf
\cp -f $script_dir/sites-enabled.$user.conf $dir_prefix/sites-enabled/$user.conf
chown -R $user: $dir_prefix
service nginx-$user start
chkconfig nginx-$user on
rm -Rf $script_dir/zlib-1.2.8
rm -Rf $script_dir/openssl-1.0.1m
rm -Rf $script_dir/nginx-1.8.0
cd $opath
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1m.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
2. 编辑可执行文件 并运行
#!/bin/bash
groupadd -g600 nginx
useradd -u600 -g600 nginx
user=nginx # change to user who run nginx
dir_prefix=/home/deploy/nginx #定义安装目录
script_path=`readlink -f $0`
script_dir=`dirname $script_path`
opath=`pwd`
yum install -y gd-devel pcre-devel libgcrypt-devel libxml2-devel libxslt-devel GeoIP-devel
tar zxvf $script_dir/zlib-1.2.8.tar.gz -C $script_dir
tar zxvf $script_dir/openssl-1.0.1m.tar.gz -C $script_dir
tar zxvf $script_dir/nginx-1.8.0.tar.gz -C $script_dir
cd $script_dir/nginx-1.8.0
./configure --prefix=$dir_prefix --user=$user --group=$user --http-log-path=$dir_prefix/log/access.log --error-log-path=$dir_prefix/log/error.log --pid-path=$dir_prefix/pid/nginx.pid
--lock-path=$dir_prefix/lock/nginx.lock --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_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_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-pcre --with-zlib=$script_dir/zlib-1.2.8
--with-openssl=$script_dir/openssl-1.0.1m
make
make install
mkdir -p $dir_prefix/sites-enabled
mkdir -p $dir_prefix/lock
\cp -f $script_dir/etc.initd.nginx-$user /etc/init.d/nginx-$user
\cp -f $script_dir/conf.nginx.conf $dir_prefix/conf/nginx.conf
\cp -f $script_dir/sites-enabled.$user.conf $dir_prefix/sites-enabled/$user.conf
chown -R $user: $dir_prefix
service nginx-$user start
chkconfig nginx-$user on
rm -Rf $script_dir/zlib-1.2.8
rm -Rf $script_dir/openssl-1.0.1m
rm -Rf $script_dir/nginx-1.8.0
cd $opath
相关文章推荐
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块
- nginx报 File not found 错误
- Nginx初探
- Nginx初探
- Nginx的源码结构和模块初始化
- Nginx 图片 js文件缓存配置方法
- nginx +php 编译
- 绝对详细!Nginx基本配置、性能优化指南
- Nginx负载均衡记录
- linux+nginx+php-fpm搭建学习笔记
- Nginx安装配置与部署
- 将nginx编译成静态库
- Nginx初探
- Nginx 改变错误日志打印级别
- Nginx 负载均衡 设置
- Nginx + PHP (Windows安装)
- 配置nginx,支持php的pathinfo路径模式
- 给Nginx配置一个自签名的SSL证书
- nginx配置拒绝直接访问js文件
- nginx 重中之重 event 模块