买了一台香港服务器来做反代,不需要完整的lnmp环境,所以单独安装nginx,将步骤记录下来备用。
1.安装支持库
yum install -y gcc gdb strace gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs patch e2fsprogs-devel krb5-devel libidn libidn-devel openldap-devel nss_ldap openldap-clients openldap-servers libevent-devel libevent uuid-devel uuid mysql-devel
2.安装pcre
wget --no-check-certificate https://www.sourceforge.net/projects/pcre/files/pcre/8.38/pcre-8.38.tar.gz
tar zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure
make&&make install
3.创建用户nginx使用的www用户
groupadd www #添加www组
useradd -g www www -s /bin/false
4.安装nginx
wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar zxvf nginx-1.9.9.tar.gz&&cd nginx-1.9.9
/configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
make&&make install
检查是否安装成功 /usr/local/nginx/sbin/nginx -t
如果是64位系统可能还需要执行:ln -s /usr/local/lib/libpcre.so.1 /lib64/