系统 Centos 64 位
第一步, 首先下载 Nginx 的 tar 包及安装依赖的工具 tar 包.
Nginx: http://nginx.org/en/download.html
Nginx 需要依赖下面 3 个包
gzip 模块需要 zlib 库 (下载: http://www.zlib.net/)
rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )
分别解压.
具体命令:
- wget http://nginx.org/download/nginx-1.13.2.tar.gz
- 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-fips-2.0.16.tar.gz
- tar zxvf openssl-fips-2.0.16.tar.gz
- tar zxvf nginx-1.13.2.tar.gz
- tar zxvf zlib-1.2.11.tar.gz
- tar zxvf pcre-8.40.tar.gz
第二步 编译安装
安装顺序: 先安装三个依赖包再安装 nginx
cd 到各个解压目录下运行
- ./configure && make && make install
- 1
- 2
安装 c++ 编译环境
- yum
- install
- gcc-c++
- 1
第三步 运行 nginx
安装好的 nginx 路径在:
- /usr/local/nginx
- 1
- 2
默认的配置文件的路径在:
- /usr/local/nginx/conf/nginx.conf
- 1
运行 nginx:
- /usr/local/nginx/sbin/nginx
- 1
通过浏览器访问服务器 ip, 出现以下标志就是启动成功了:
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
有问题之处烦请在留言中指出, 非常感谢.
来源: http://www.bubuko.com/infodetail-2575570.html