Linux下搭建Nginx代理访问MongoDB GridFS图片资源



  • PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
    export PATH
     
    #需要切换到root用户
    if [[ $EUID -ne 0 ]]; then
        echo "This script must be run as root"
        exit 1
    fi
     
    ROOT_PATH=/usr/local/src/nginxAbout
    mkdir $ROOT_PATH
    rm -rf $ROOT_PATH/*
     
    ##################################################
    # 必要的工具
    ##################################################
     
    yum -y install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch gettext glib2-devel bzip2-devel libuuid-devel docbook-style-xsl libxslt-devel gzip-devel
     
    ##################################################
    # 安装Nginx
    ##################################################
     
    #安装pcre库
    cd $ROOT_PATH
    wget -c

    本帖下載内容已隐藏,请登入以查看隐藏内容!
    -O nginx-1.4.4.tar.gz
    tar -xzvf ./nginx-1.4.4.tar.gz
    cd ./nginx-1.4.4
    mkdir /usr/local/nginx
    #配置一些参数,其中用户名和组都是nginx
    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=$ROOT_PATH/pcre-8.36 --with-zlib=$ROOT_PATH/zlib-1.2.8 --with-openssl=$ROOT_PATH/openssl-1.0.1e --add-module=$ROOT_PATH/nginx-gridfs-0.8
    make && make install
     
     
    #添加nginx用户及用户组(这个很必须和之前配置的用户和组对应)
    groupadd nginx  #添加nginx用户组及用户
    useradd -g nginx -s /usr/sbin/nologin nginx  #不让nginx用户直接登录


  • 註冊用戶

    不错的文章,学习了。


登录后回复
 

与 萌阔论坛 的连接断开,我们正在尝试重连,请耐心等待