- 更新系统软件
yum update
- 安装nginx所需的依赖库
yum -y install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install oopenssl-devel libssl-dev
- 下载并上传Nginx安装包(nginx-1.11.8.tar.gz)至/usr/local
- 解压安装包,并重命名
tar -zxvf nginx-1.11.8.tar.gz
mv nginx-1.11.8 nginx
- 进入nginx目录,编译安装
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module
make
make install
- 启动Nginx
/usr/local/nginx/nginx
- 验证,在浏览器中数据
http://IP/
,看到Nginx欢迎页面。
参考:
https://www.godaddy.com/garage/tech/config/how-to-install-and-configure-nginx-on-centos-7/