2019独角兽企业重金招聘Python工程师标准>>>
在Ubuntu下编译安装nginx,首先去下载nginx的安装包。
http://nginx.org/en/download.html
下载对应的压缩包后,解压。执行命令编译安装
tar -zxvf ./nginx-1.10.1.tar.gz
cd nginx-1.10
./configure --prefix=/usr/local/nginx
#这时候出现了第一个问题
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
此时需要安装pcre这个插件,本企图手动编译这个插件,无奈多次都失败,有大神知道的话,还请评论解答。
使用ubuntu的依赖安装
sudo apt-get install libpcre3 libpcre3-dev
#这时出现了第二个问题
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
此时需要安装zlib插件,手动编译失败后,转向ubuntu的依赖安装
sudo apt-get install zlib1g-dev
#接下来就是编译安装
./configure --prefix=/usr/local/nginx
make
make install