Ubuntu 12.04 LTS 安装 Nginx 1.6.0

网上资料很多,这里只针对自己的安装过程做一个记录

部分命令需要管理员权限,需要使用 sudostep 0 – 删除错误的安装    根据 nginx.org 上的文档,安装后发现版本很老,删除之

apt-get purge nginx
apt-get autoremove

step 1 - 安装编译器

apt-get install build-essential  
apt-get install libtool  

接下来安装PCRE,zlib 和 SSL。参考网上的文档,下载的源码存放到目录 /usr/local/src

step 2 - 安装 PCRE, Perl Compatible Regular Expressions

从 pcre.org 找到并下载
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make
make install

step 3 - 安装 zlib,用于对http包进行gzip压缩

从 zlib.net 找到并下载
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install


step 4 - 安装openssl

从 openssl.org 找到并下载
tar -zxvf openssl-1.0.1g.tar.gz

step 5 - 安装Nginx

从 nginx.org 找到并下载最新稳定版
tar -zxvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
sudo ./configure --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35 --with-zlib=/usr/local/src/zlib-1.2.8 --with-openssl=/usr/local/src/openssl-1.0.1g
make
make install


step 6 - 启动nginx

#检查80端口是否被占用
netstat -ano |grep 80

#启动nginx
sudo /usr/local/nginx/sbin/nginx


在浏览器中访问 http://localhost,成功打开 Welcome to nginx 页面

感谢前人的文档:http://www.cnblogs.com/qtsharp/archive/2013/05/06/3061987.html

装好之后,在 Nginx wiki 上看到另一个做法:用deb命令添加 resource,然后再用 apt-get 命令安装。下次重新安装再试一试。

    http://wiki.nginx.org/Install

猜你喜欢

转载自blog.csdn.net/oldcrane/article/details/24630665