首页 > 代码库 > nginx编译安装
nginx编译安装
- ./configure: error: C compiler cc is not found
- 安装GCC后再次运行
hecking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found
./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.
解决方法:yum -y install pcre-devel
- 再次运行
报错:
checking for PCRE JIT support ... not found
checking for OpenSSL library ... not found
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
解决方法:yum -y install openssl openssl-devel
最后运行
安装完毕后用/usr/local/nigix/sbin/
启动nginx #./nginx
遇到的问题
启动nginx报nginx: [emerg] getpwnam("www") failed
在nginx.conf中 把user nobody的注释去掉既可
检查是否启动成功:
netstat -ano|grep 80 有结果输入说明启动成功
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功
ps:注意:此处需要关闭防火墙 service iptables stop
重启
/usr/local/nginx/sbin/nginx –s reload
或者 killall -HUP nginx
参考链接:http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3118061.html
nginx编译安装