美文网首页
【阿里云ECS】三.安装Nginx

【阿里云ECS】三.安装Nginx

作者: 印比八方来 | 来源:发表于2021-05-25 16:41 被阅读0次

1.创建nginx用户

groupadd nginx
useradd -s /sbin/nologin -g nginx nginx

2.安装必要文件

yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel
yum install -y unzip zip

3.下载所需文件

wget  http://tengine.taobao.org/download/tengine-2.1.2.tar.gz

下载其他软件pcre-8.39.zipGeoIP.tar

4.解压文件

tar zxvf tengine-2.1.2.tar.gz 
unzip pcre-8.39.zip 
tar -xvf GeoIP.tar && cd GeoIP-1.4.8 

5.编译GeoIP

./configure && make && make install

6.编译nginx

cd tengine-2.1.2

./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_stub_status_module --without-select_module --without-poll_module --with-http_geoip_module --with-http_ssl_module --with-openssl-opt=enable-tlsext --with-pcre=../pcre-8.39

make && make install

7.上传geoip文件夹

8.检查配置

/usr/local/nginx/sbin/nginx -t

如果是64位系统可能会报:

/nginx: error while loading shared libraries: libGeoIP.so.1: cannot open shared object file: No such file or directory

解决方法:

ln -s /usr/local/lib/libGeoIP.so* /lib64/

相关文章

网友评论

      本文标题:【阿里云ECS】三.安装Nginx

      本文链接:https://www.haomeiwen.com/subject/kdmwjltx.html