前言:
详细步骤移步菜鸟教程
一、 安装Nginx,注意虚拟机与宿主机的网络连通性
l 安装编译工具及库文件(zlib库、 ssl)
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
l 安装PCRE
1. 下载解压pcre包
cd /usr/local/src/
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar zxvf pcre-8.35.tar.gz
2. 进入安装包目录,编译与安装
cd pcre-8.35
./configure
make && make install
3. 验证安装成功
pcre-config –version
l 安装Nginx
1. 下载与解压Nginx包
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
2. 编译与安装
cd nginx-1.6.2
./configure –prefix=/usr/local/webserver/nginx –with-http_stub_status_module –with-http_ssl_module –with-pcre=/usr/local/src/pcre-8.35
make && make install
注:
Nginx程序文件目录:/usr/local/webserver/nginx/sbin/nginx
Nginx.conf配置文件目录:/usr/local/webserver/nginx/conf/nginx.conf
配置文件目录:/usr/local/webserver/nginx
默认网页文件目录:/usr/local/webserver/nginx/html
3. 验证是否安装成功
/usr/local/webserver/nginx/sbin/nginx -v