开始nginx的学习,书已经买了2个月了,昨天翻了下书还是新的 HO,太浪费了。。争取一个月搞定哈。
准备环境:
一、VMware centos 5.5
先看下编译参数把:
--prefix //安装路径
--sbin-path //可执行文件安装路径
--conf-path //配置文件路径
--pid-path //放置pid路径
--lock-path //nginx.lock放置路径
--error-log-path //错误日志放置路径
--http-log-path //访问日志路径
--user //启动用户
--group //启动组
--builddir //指定编译的目录
--with-rtsig_module //启动rtsig模块
--with-select-module //允许或不允开启SELECT模式
--with-poll_moduel //允许或不允许开启poll模式
--with-http_ssl_module //开启http_ssl模块
--with-http_realip_module
--with-http_addition_module
--with-http_dav_module
--with-http_flv_module
--with-stub_status_module
--without-http_charset_module
--without-http_gzip_module
--without-http_ssl_module
--without-http_userid_module
--without-http_access_module
--without-http_auth_basic_module
--without-http_autoindex_module
--without-http_geo_module
--without-http_map_module
--without-http_referer_module
--without-http_rewrite_module
--without-http_proxy_module
--without-http_fastcgi_module
--without-http_memcached_module
--without-http_limit_zone_module
--without-http_empty_gif_module
--without-http_browser_module
--without-upstream_ip_hash_module
--with-http_pcel_module
--with-perl=PATH //指定PERL模块路径
--with-log-path //日志访问路径
--http-client-body-temp-path //请求缓存文件
--http-proxy-temp-path //反向代理缓存文件
--http-fastcgi-temp-path //fastcgi缓存文件存放路径
--without-http //禁用httpserver
--with-mail //启用IMAP4/POP3/SMTP代理模式
--with-mail_ssl_module
--with-cc 指定c编译器的路径
--with-cpp 指定c预处理器的路径
--with-cpu-opt 为特定的CPu编译
--without-pcre 禁止PCRE
--with-pcre 指定PCRE库的源代码路径
--with-pcre-opt 设置PCRE的额外编译选项
--with-md5 设置MD5的源代码路径
--with-md5-opt 设置MD5库的额外编译选项
--with-md5-asm 使用MD5汇编源代码
--with-shal 设置shal库的源代码路径
--with-shal-asm 使用shal汇编源码
--with-zlib 设置ZLIB库的源代码路径
--with-zlib-opt 设置zlib库选项
--with-zlib-asm zlib针对CPU的优化
--with-openssl 设置openssl源代码路径
--with-openssl-option 设置openssl库的源代码路径
--with-debug 启动调试日志
--add-module 添加一个指定路径,能找到第三方模块
写这么多累死了,nginx的参数不算太多,没注释都是开启或关闭模块(懒)
先写下我的编译参数把:
./configure /
--prefix=/usr/local/nginx
--conf-path=/etc/nginx/nginx.conf
--pid-path=/var/run/nginx/nginx.pid
--error-log-path=/var/log/nginx/error.log
--user=www
--group=www
--with-http_ssl_module
--with-http_flv_module
--with-http_gzip_module
--http-client-body-temp-path=/var/tmp/nginx/client
--http-proxy-temp-path=/var/tmp/nginx/proxy
--http-fastcgi-temp-path=/var/tmp/nginx/fast
由于开始只用的gzip,ssl,flv模块,只编译进来几个模块即可,
安装过程中遇到的问题:
1、gcc is not found
原因:没有安装gcc编译器
解决:yum install gcc
2、./configure: error: the HTTP rewrite module requires the PCRE library.
原因:安装http_rewrite_module模块需要先安装PCRE开发包
解决:yum install pcre-devel
3、./configure: error: the HTTP SSL module requires OpenSSL library
原因:安装http_ssl_module模块需要openssl library
解决:yum install openssl-devel
这几个问题大部分都是缺少库文件,安装即可,安装会提示你输入Y,如果不想输入加上-y参数,如: yum -y install openssl-devel
make && make install 安装完毕
启动nginx /usr/local/webserver/sbin/nginx
查看nginx是否启动: ps aux | grep nginx