首页 > 代码库 > Nginx 安装配置

Nginx 安装配置

#!/bin/bash
if [ ! -d /data ];then
mkdir -p /data 
fi
cd /root/soft
tar zxvf nginx-lua.tar.gz 
cd nginx-lua
tar zxvf LuaJIT-2.0.2.tar.gz 
cd LuaJIT-2.0.2
make
make install PREFIX=/usr/local/luajit  
ln -sf luajit-2.0.2 /usr/local/luajit/bin/luajit
export LUAJIT_LIB=/usr/local/luajit/lib  
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0/
echo "export LUAJIT_LIB=/usr/local/luajit/lib" >>/etc/profile
echo "export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0/" >>/etc/profile
cd /root/soft/nginx-lua
tar zxvf ngx_devel_kit-0.2.18.tar.gz 
cd /root/soft/nginx-lua
tar zxvf lua-nginx-module-0.7.15.tar.gz 
cd /root/soft/nginx-lua
tar zxvf pcre-8.31.tar.gz
cd pcre-8.31
./configure 
make
make install
cd /root/soft/nginx-lua
tar zxvf nginx-1.4.1.tar.gz
cd nginx-1.4.1
./configure  --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --with-pcre=/root/soft/nginx-lua/pcre-8.31 --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --without-http_geo_module --add-module=/root/soft/nginx-lua/ngx_devel_kit-0.2.18 --add-module=/root/soft/nginx-lua/lua-nginx-module-0.7.15
make
make install
useradd -M -s /sbin/nologin nginx
mkdir /data/logs
sed -i ‘s/#user  nobody/user  nginx/‘ /usr/local/nginx/conf/nginx.conf
sed  -i ‘/events/ a\ use epoll ;‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘s/1024/65535/‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘s/#gzip/gzip/‘  /usr/local/nginx/conf/nginx.conf
sed -i ‘s/#charset koi8-r/charset utf-8/‘ /usr/local/nginx/conf/nginx.conf
sed  -i ‘s/index.htm;/index.htm index.php;/‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘s/root   html/root  \/data/‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘66  s/#location/location/‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘67  s/html/\/data/ ; s/#    root/     root/‘ /usr/local/nginx/conf/nginx.conf
sed -i ‘68,69 s/#//‘  /usr/local/nginx/conf/nginx.conf
sed -i ‘70 s/#// ;s/scripts/data/‘  /usr/local/nginx/conf/nginx.conf
sed -i ‘71,72 s/#//‘  /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx

注:Nginx版本为:1.4.1 软件包请自行下载!

本文出自 “成都@阿状” 博客,请务必保留此出处http://azhuang.blog.51cto.com/9176790/1551546

Nginx 安装配置