Home  >  Article  >  Backend Development  >  Steps to install nginx from source code under Ubuntu 1610 ubuntu15.04 linux ubuntu 16.04

Steps to install nginx from source code under Ubuntu 1610 ubuntu15.04 linux ubuntu 16.04

WBOY
WBOYOriginal
2016-07-29 08:52:081023browse

1. Download the source code:

<code>$ cd /usr/downloads
$ wget -c http://nginx.org/download/nginx-1.8.1.tar.gz
$ tar -xvf nginx-1.8.1.tar.gz
$ cd nginx-1.8.1
</code>

2. Install dependencies: pcre

1) First try to install
<code>$ cd ..
$ wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.gz
$ tar -xvf pcre2-10.21.tar.gz
$ ./configure
$ make & make install
$ pcre2grep --help
> "error while loading shared libraries: libpcre8.so.0 cannot find"
$ ls /usr/local/lib            #查看是否存在该so文件
$ sudo /sbin/ldconfig -v   #更新共享库文件的索引
</code>
2) Perform check again:
<code>$ ./configure --with-pcre=/usr/software/pcre2-10.21     #ok
$ sudo make
> pcre.h 文件找不到
$ sudo ../pcre2-10.21/configure
## 发现 nginx 中引用的是 pcre.h,而pcre2-10.21释放的是pcre2.h, 好吧,被自己不认真给坑了
</code>
3) Switch pcre version:
<code>$ wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.zip
$ unzip pcre-8.38.zip
$ cd pcre-8.38
$ sudo ./configure
$ sudo make & make install
</code>

3. Install nginx

<code>$ cd ../nginx-1.8.1
$ sudo ./configure
$ sudo make & make install
# 一切ok
</code>

4. Configuration

* To be continued*

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the steps to install nginx from source code under Ubuntu 1610, including ubuntu content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn