实例类型:操作系统: CentOS 7.4 64位 nginx 1.10
1、创建目录,安装一些依赖
cd /usr/local/src/nginx-files
wget http://www.zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
wget http://nginx.org/download/nginx-1.10.3.tar.gz
2、解压到当前目录
tar zxvf pcre-8.40.tar.gz
tar zxvf zlib-1.2.11.tar.gz
tar zxvf openssl-1.1.0e.tar.gz
3、然后打开解压的nginx文件夹
yum install gcc gcc-c++ ncurses ncurses-devel bison libgcrypt perl automake autoconf libtool make
4、在该目录下安装编译文件
#增加系统用户 www
groupadd www
useradd -r -g www www
5、执行编译
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-poll_module --with-select_module --with-pcre=/usr/local/src/nginx-files/pcre-8.40 --with-zlib=/usr/local/src/nginx-files/zlib-1.2.11 --with-openssl=/usr/local/src/nginx-files/openssl-1.1.0e
make
make install
6、查看nginx是否启动
ps axu | grep nginx
7、启动之后,执行 ps axu | grep nginx 会看到如下界面:说明启动成功
8、当nginx启动以后,在浏览器输入自己服务器的ip,看是否能给出来 welcome to nginx页面,如果出不来,需要登陆阿里云设置安全组,添加新的端口号范围
9、再次输入服务器的ip加上80端口就可以出现welcone to nginx 页面了