Debian установка nginx из исходников, компиляция с дополнительными модулями

Небольшое howto по сборке nginx из исходников.
Ставим зависимости
aptitude install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev |
выкачиваем nginx, мне также необходим был модуль headers-more-nginx-module
распаковываем наше добро
tar zxf nginx-1.4.7.tar.gz |
конфигурируем
./configure --prefix=/usr --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/lock/nginx.lock --with-http_ssl_module --user=nginx --group=nginx --with-http_stub_status_module --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --add-module=~/headers-more-nginx-module-0.25/ |
через --add-module=~/headers-more-nginx-module-0.25/ — задаем путь к доп модулю
компилируем, устанавливаем
создадим стартовый скрипт
# Short-Description: starts the nginx web server |
# Description: starts nginx using start-stop-daemon |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
test -x $DAEMON || exit 0 |
# Include nginx defaults if available |
if [ -f /etc/default/nginx ] ; then |
. /lib/lsb/init-functions |
echo -n "Starting $DESC: " |
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ |
--exec $DAEMON -- $DAEMON_OPTS || true |
echo -n "Stopping $DESC: " |
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ |
echo -n "Restarting $DESC: " |
start-stop-daemon --stop --quiet --pidfile \ |
/var/run/$NAME.pid --exec $DAEMON || true |
start-stop-daemon --start --quiet --pidfile \ |
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true |
echo -n "Reloading $DESC configuration: " |
start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \ |
status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $? |
echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2 |
делаем исполняемым, добавляем в автозагрузку
chmod +x /etc/init.d/nginx |
update-rc.d -f nginx defaults |