RHEL 7 安装 ngnix

安装ngnix

yum install -y make apr* autoconf automake curl curl-devel gcc gcc-c++ gtk+-devel zlib-devel pcre-devel

wget http://nginx.org/download/nginx-1.7.2.tar.gz

cd nginx-1.7.2

./configure --prefix=/usr/local/nginx

make && make install

启动 /usr/local/nginx/sbin/nginx

停止 /usr/local/nginx/sbin/nginx -s stop

记得开防火墙80。

出问题看下面内容:

 ./configure: error: the HTTP rewrite module requires the PCRE library解决

    有时候,我们需要单独安装nginx,来处理大量的下载请求。

    安装nginx遇到的rewrite和HTTP cache错误解决办法:

    ./configure --prefix=/usr/local/nginx

    安装Nginx时报错

    ./configure: error: the HTTP rewrite module requires the PCRE library.

    安装pcre-devel解决问题

    yum -y install pcre-devel

    错误提示:./configure: error: the HTTP cache module requires md5 functions

    from OpenSSL library. You can either disable the module by using

    --without-http-cache option, or install the OpenSSL library into the system,

    or build the OpenSSL library statically from the source with nginx by using

    --with-http_ssl_module --with-openssl= options.

    解决办法:

    yum -y install openssl openssl-devel

    总结:

    yum -y install pcre-devel openssl openssl-devel

    ./configure --prefix=/usr/local/nginx

    make

    make install

配置PHP-FPM/fast-cgi  

yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel mysql-devel libtool-ltdl-devel

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

tar zxvf libiconv-1.13.1.tar.gz

cd  libiconv-1.13.1

./configure
make && make install

wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make && make install
/sbin/ldconfig

wget
http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.
9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

ln -s /usr/local/lib/libmcrypt.* /usr/lib/ (是否为rpm 包安装)
ln -s /usr/local/lib/libmhash.* /usr/lib/ (是否为rpm 包安装)

http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

wget http://cn2.php.net/distributions/php-5.5.13.tar.gz
cd php-5.5.13

./configure --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysql --with-mysqli=/usr/bin/mysql_config --with-iconv=/usr/local --with-freetype-dir --with-jpeg-dir
--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --
enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --
enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pdo-mysql --without-pear --enable-fastcgi --enable-force-cgi-redirect --enable-fpm

make && make install

原文地址:https://www.cnblogs.com/jjp816/p/4436452.html