nginx学习2——ubuntu下配置nginx

本文档详述了在Ubuntu系统中安装配置nginx的过程,包括zlib、pcre、openssl库的安装,以及libgd2-xpm的安装。在安装nginx时,特别提到了配置选项,并提供了启动nginx的方法及检查配置成功的标志。

安装C/C++编译器
#apt-get install gcc
gcc安装相关构建工具
#apt-get install build-essential
zlib安装:

#wget http://www.zlib.net/zlib-1.2.11.tar.gz

#tar -xvzf zlib-1.2.11.tar.gz

#cd zlib-1.2.11.tar.gz
#./configure
#make
#sudo make install

pcre安装:

#wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz

#tar -xvzf pcre-8.40.tar.gz

#cd pcre-8.40
#./configure
#make
#sudo make install

openssl 库安装

#wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz

#cd openssl-1.0.1e/
#./configure 或者 #./config
#make
#sudo make install

通过openssl version命令查看是否安装成功。

libgd2-xpm安装

#apt-get install libgd2-xpm libgd2-xpm-dev 

nginx安装

#wget http://nginx.org/download/nginx-1.12.0.tar.gz

#tar zxvf nginx-1.2.0.tar.gz

#cd nginx-1.2.0

#./configure --prefix=/usr/nginx --with-http_ssl_module --with-http_image_filter_module

或者

#./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module--with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11--with-openssl=../openssl-1.0.1e --with-http_stub_status_module 

#make
#make install

启动nginx

首先到如下目录

#cd /usr/nginx/sbin/

#sudo ./nginx

进入浏览器输入http://localhost,如果看到如下界面,则配置成功


注意:

1.

  1. ./configure: error: the HTTP image filter module requires the GD library.  
  2. You can either do not enable the module or install the libraries.  
  3. ”  
  4. apt-get install libgd2-xpm libgd2-xpm-dev  
2.每次安装都可以用

echo $? 命令来检查是否有安装错误的地方


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值