На одном из vps понадобились модули ( —without-http_limit_req_module —without-http_limit_zone_module ) к вэб серверу nginx.
nginx сыпал такие сообщения в лог файл.
2012/07/15 21:46:19 [emerg] 2620#0: unknown directive "limit_req_zone" in /etc/nginx/nginx.conf:13
А при проверки конфигурационного nginx выдавало такое.
# /etc/init.d/nginx reload Reloading nginx configuration: nginx: [emerg] unknown directive "limit_req_zone" in /etc/nginx/nginx.conf:13 nginx: configuration file /etc/nginx/nginx.conf test failed
Для начало посмотрим собран ли nginx с этими модулями.
# nginx -V nginx version: nginx/1.2.1 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-file-aio --with-http_gzip_static_module --with-http_ssl_module --with-ipv6 --without-http_browser_module --without-http_geo_module --without-http_limit_req_module --without-http_limit_zone_module --without-http_memcached_module --without-http_referer_module --without-http_scgi_module --without-http_split_clients_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_uwsgi_module --add-module=/usr/src/nginx/source/nginx-1.2.1/debian/modules/nginx-echo
Как видим nginx собран без поддержки этих модулей.
Теперь приступим к сборке nginx с нужными модулями. Все проделанное будет происходить на системе Debian Linux.
Установим библиотеку для сборки nginx.
# aptitude install dpkg-dev
Теперь скачаем сорцы с репозитория debian.
На данный момент стабильная версия nginx 1.2.2
# cd /usr/local/ng/ # wget http://nginx.org/packages/debian/pool/nginx/n/nginx/nginx_1.2.2.orig.tar.gz http://nginx.org/packages/debian/pool/nginx/n/nginx/nginx_1.2.2-1~squeeze.dsc http://nginx.org/packages/debian/pool/nginx/n/nginx/nginx_1.2.2-1~squeeze.debian.tar.gz
Теперь нам надо разорхевировать.
# dpkg-source -x nginx_1.2.2-1~squeeze.dsc
Перейдем в только, что распакованную директорию nginx.
Теперь соберем nginx с нужными модулями или же добавим нужные модули в файл nginx-0.8.54/debian/rules
override_dh_auto_build: dh_auto_build mv objs/nginx objs/nginx.debug ./configure \ --prefix=/etc/nginx/ \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --http-client-body-temp-path=/var/cache/nginx/client_temp \ --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ --user=nginx \ --group=nginx \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --without-http_mp4_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --without-mail \ --without-mail_ssl_module \ --with-file-aio \ --without-ipv6 dh_auto_build
Поддержка ipv6 и mp4 мне не нужна я убрал просто измени запись without ( без ).
Все нужные модули добавили не нужные убрали, теперь соберем deb пакет.
# dpkg-buildpackage -uc -b -us
До установим еще один пакет nginx-common.
Теперь поднимаемся на уровень выше.
# cd .. && dpkg -i nginx_1.2.2+squeeze_i386.deb
Проверим.
# nginx -V
И последнее только что собранный пакет нужно поменить, что бы в дальнейшем менеджер пакетов его не предлагал обновить.
# echo "nginx hold" | dpkg --set-selections
Проверим все ли в порядке.
# dpkg --get-selections | grep nginx nginx hold
Вот и все.
[…] Настройка nginx […]
Я тоже nginx пересобирал на FreeBSD 9.
Но почему-то с первого раза не завелся nginx, видимо много параметров указал, не было запускаемого файла nginx, не было запускаемого файла.
Собирал с такими флагами.
./configure --with-http_ssl_module --prefix=/usr/local --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/ram_disk/error.log --http-log-path=/var/log/ram_disk/access.log --with-http_perl_module --add-module=/root/scripts/nginx/testcookie --without-poll_module
После все завелось нормально.