首页 > 代码库 > Nginx搭建&配置

Nginx搭建&配置

1. 安装pcre库
cd /usr/local
wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35.tar.gz
./configure
make
make install
 
pcre下载路径
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
http://sourceforge.net/projects/pcre/files/pcre/
 
安装pcre 出现错误
configure: error: You need a C++ compiler for C++ support.
apt-get install g++
 
2. 安装zlib库
cd /usr/local
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
 
3. 安装ssl
cd /usr/local
wget http://www.openssl.org/source/openssl-1.0.1l.tar.gz
tar -zxvf openssl-1.0.1l.tar.gz
cd openssl-1.0.1l
./config
make
make install
 
4. 安装nginx
cd /usr/local
wget http://nginx.org/download/nginx-1.7.8.tar.gz
tar -zxvf nginx-1.7.8.tar.gz
cd nginx-1.7.8
./confiure —prefix=/usr/local/nginx
make
make install
 
启动
/usr/local/nginx/sbin/nginx
检查启动
netstat -ano | grep 80
打开浏览器,输入本机IP访问
 
重启
/usr/local/nginx/sbin/ngnix -s reload
 
修改配置文件
cd /usr/local/nginx/conf
vi nginx.conf

Nginx搭建&配置