Ubuntu 12.04 LTS 安装 Nginx 1.6.0

来源:互联网 发布:linux shell rm rf 编辑:程序博客网 时间:2024/05/29 18:17

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

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

apt-get purge nginxapt-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.gzcd pcre-8.35./configuremakemake install

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

从 zlib.net 找到并下载tar -zxvf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremakemake 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.gzcd nginx-1.6.0sudo ./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.1gmakemake install

step 6 - 启动nginx
#检查80端口是否被占用netstat -ano |grep 80#启动nginxsudo /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


0 0
原创粉丝点击