欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

centos66编译安装nginx-180

程序员文章站 2024-04-06 11:15:07
...
1. 创建放置安装包的目录:

mkdir nginx-install

cd nginx-install

2. 下载相关安装包:

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


3. 执行以下安装脚本:

#!/bin/bash

user=buser           # change to user who run nginx
dir_prefix=/home/$user/nginx       # change to your prefered install dir
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-libatomic --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


以上就介绍了centos66编译安装nginx-180,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。