本文主要记录Nginx 安装过程
- 安装包的获取
http://nginx.org/en/download.html
- 安装步骤
1、创建文件夹:mkdir -p /apps/svr/nginx
2、解压文件:tar -zxvf nginx-1.2.9.tar.gz
3、切换到源码路径:cd /apps/svr/nginx/nginx-1.2.9
编译安装
1、Nginx开启SSL模块:./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
2、过程问题处理:
报错:
checking for OS
+ Linux 2.6.32-504.el6.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler gcc is not found
原因是缺少C编译器,安装gcc: yum install gcc
报错:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
缺少PCRE包,安装系统版本的PRCE包:yum install pcre-devel
报错:
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
安装penSSL库到系统中:yum install openssl openssl-devel
- 编译安装
make & make install
- 启动
cd /usr/local/nginx/sbin;
./nginx
- 测试
浏览器打开:http://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.