Nginx 的编译安装

回复 收藏
# tar zxvf nginx-0.6.29-tar.gz
# cd nginx-0.6.29
  ./configure \
    "--prefix=/usr/local/nginx" \
    "--sbin-path=/usr/local/nginx/sbin/nginx" \
    "--conf-path=/usr/local/nginx/conf/nginx.conf" \
    "--error-log-path=/usr/local/nginx/logs/error.log" \
    "--http-log-path=/usr/local/nginx/logs/access.log" \
    "--pid-path=/usr/local/nginx/var/nginx.pid" \
    "--lock-path=/usr/local/nginx/var/nginx.lock" \
    "--http-client-body-temp-path=/dev/shm//nginx_temp/client_body" \
    "--http-proxy-temp-path=/dev/shm/nginx_temp/proxy" \
    "--http-fastcgi-temp-path=/dev/shm/nginx_temp/fastcgi" \
    "--user=www" \
    "--group=www" \
    "--with-cpu-opt=pentium4F" \
    "--without-select_module" \
    "--without-poll_module" \
    "--with-http_realip_module" \
    "--with-http_sub_module" \
    "--with-http_gzip_static_module" \
    "--with-http_stub_status_module" \
    "--without-http_ssi_module" \
    "--without-http_userid_module" \
    "--without-http_geo_module" \
    "--without-http_memcached_module" \
    "--without-http_map_module" \
    "--without-mail_pop3_module" \
    "--without-mail_imap_module" \
    "--without-mail_smtp_module" \
    "--with-pcre"
# make
# make install

# mkdir /dev/shm/nginx_temp

注:有时会因为pcre编译不过去,需要修改一下 --with-pcre=/usr/local/src/pcre-7.8,前提是已经下载了pcre源码包,并解压,不需要编译pcre。
2009-09-26 08:47 举报
已邀请:
0

阿铭老师 管理员

赞同来自:

本帖最后由 andy 于 2009-11-20 11:33 编辑

今天编译出现如下错误:
src/core/ngx_regex.h:14:36: error: /usr/include/pcre/pcre.h: No such file or directory
In file included from src/core/ngx_core.h:62,
                 from src/core/nginx.c:8:
src/core/ngx_regex.h:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ngx_regex_t’
src/core/ngx_regex.h:24: error: expected specifier-qualifier-list before ‘ngx_regex_t’
src/core/ngx_regex.h:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/core/ngx_regex.h:32: error: expected ‘)’ before ‘*’ token
src/core/ngx_regex.h:33: error: expected ‘)’ before ‘*’ token
make[1]: *** [objs/src/core/nginx.o] Error 1
make[1]: Leaving directory `/usr/local/src/nginx-0.6.39'
make: *** [build] Error 2

仔细查看出错信息,提示没有/usr/include/pcre/pcre.h这个文件,经检查确实没有/usr/include/pcre/pcre.h ,但是有/usr/include/pcre.h, 于是做软连接
mkdir /usr/include/pcre
ln -s /usr/include/pcre.h /usr/include/pcre/pcre.h

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: