开始我只需要一个nginx ,但是在我们运维在用tengine,于是百度了下,如下是tengine安装过程。。。 #所需tar包 #tengine-2.1.1.tar.gz #zlib-1.2.8.
开始我只需要一个nginx ,但是在我们运维在用 tengine,于是百度了下,如下是tengine安装过程。。。
#所需tar包
#tengine-2.1.1.tar.gz
#zlib-1.2.8.tar.gz
#openssl-1.0.1s.tar.gz
#pcre-8.38.tar.gz
#如果需要安装包对应下载。http://tengine.taobao.org/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1s.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
这里就不提供了
#依赖包安装
yum install -y gd gd-devel gcc gcc-c++
# ubuntu 没有没有yum 仓库什么的,懒得弄,用
apt-get install gd gd-devel gcc gcc-c++
#结果没有gd库 和gcc库,太恶心了,只能更新源,我用阿里云的源。。。最后还是不行,只能往下走go
cd /usr/local/src/
#解压
tar fxz zlib-1.2.8.tar.gz
tar fxz openssl-1.0.1s.tar.gz
tar fxz pcre-8.38.tar.gz
tar fxz tengine-2.1.1.tar.gz
cd tengine-2.1.1
#编译开始
./configure /
--prefix=/usr/local/nginx /
--conf-path=/usr/local/nginx/conf/nginx.conf /
--pid-path=/usr/local/nginx/nginx.pid /
--without-http_memcached_module /
--user=www /
--group=www /
--with-poll_module /
--with-syslog /
--with-http_image_filter_module /
--with-http_stub_status_module /
--with-http_ssl_module /
--with-http_gzip_static_module /
--with-openssl=/usr/local/src/openssl-1.0.1s /
--with-zlib=/usr/local/src/zlib-1.2.8 /
--with-pcre=/usr/local/src/pcre-8.38 /
--with-http_sub_module /
--with-http_realip_module /
--with-http_sysguard_module
make
make install
#配置文件修改
cd /usr/local/nginx/conf
vi nginx.conf
#启动
/usr/local/nginx/sbin/nginx
========================
备注;
./configure /
--prefix=/Data/servers/nginx /
--conf-path=/Data/servers/nginx/conf/nginx.conf /
--pid-path=/Data/servers/nginx/nginx.pid /
--without-http_memcached_module /
--user=www /
--group=www /
--with-poll_module /
--with-syslog /
--with-http_image_filter_module /
--with-http_stub_status_module /
--with-http_ssl_module /
--with-http_gzip_static_module /
--with-openssl=/usr/local/src/openssl-1.0.1s /
--with-zlib=/usr/local/src/zlib-1.2.8 /
--with-pcre=/usr/local/src/pcre-8.38 /
--with-http_sub_module /
--with-http_realip_module /
--with-http_sysguard_module
#备注错误问题
错误提示“ ./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
”
没有安装DG 库,原因是unbunte
百度上有个 apt-get install libgd2-xpm libgd2-xpm-dev 但是 libgd2-xpm 和 libgd2-xpm-dev 没有
在经过多次尝试 使用 apt-get install libgd-dev 成功!!!!
错误提示“nginx: [emerg] getpwnam(“www”) failed”
解决方案一
在nginx.conf中 把user nobody的注释去掉既可
解决方案二
错误的原因是没有创建www这个用户,应该在服务器系统中添加www用户组和用户www,如下命令:
/usr/sbin/groupadd -f www
/usr/sbin/useradd -g www www
还有就是路径问题。。。
其实我完全可以用apt-get install nginx ,最简单的安装。不过日后配置比较繁琐,这里就不累述了。