Running OpenResty схвати в service on Ubuntu 14.04

I need to использовал Nginx with Lua and в sheaf of other extensions enabled so I have followed the instructions at https://openresty.org / and compiled the OpenResty variant of Nginx. That process went pretty smoothly and now I have nginx at /usr/local/openresty/nginx/sbin/. The версия reported when I execute ./nginx -v is 1.9.3.2 - correct. I хан get the server up and running by executing ./nginx.

However, what I would like to be able to do is to have it run схвати в service at startup the way it usually works when you do в vanilla Nginx install путь apt-get install nginx. I would also like to be able to использовал commands such туз service nginx status|restart|stop|reload и т.д. I am an utter and завершил newbie when it ты ешь to this sort of thing. I have tried to understand the contents of the /etc/init.d/nginx рукописный шрифт on one of my other servers but modifying it to work with the present installation is not something I understand. I am hoping that someone here will be able to help.

0
задан 3 December 2015 в 16:21

1 ответ

И теперь, ответ Ubuntu.

Вы используете Ubuntu Linux. У Вас уже есть или выскочка или systemd (первый в данном случае). не начинаются системой письменности 5 rc сценарии.

Так пишут новомодный файл задания. Уже возьмите одного из тех записанный для nginx, на самом деле, и измените его для OpenResty.

версия 15.10 Ubuntu nginx-общий пакет идет с новомодным предоставленным файлом задания, прямо из поля, как /etc/init/nginx.conf; хотя версия 14.04 Ubuntu nginx-общий пакет является несколькими версиями позади и не делает. Довольно легко вытянуть файл непосредственно из исходного репозитория Debian ( nginx.upstart ). Существует также /etc/init/nginx.conf файл задания на nginx Wiki.

Применение Ваших модификаций OpenResty приводит к этому:

# /etc/init/openresty.conf

description "OpenResty nginx"

start on filesystem and static-network-up
stop on runlevel [016]

env DAEMON='/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf'

expect fork
respawn

pre-start script
    [ -x $DAEMON ] || { stop; exit 0; }
    $DAEMON -t || { stop; exit 0; }
end script

exec $DAEMON 

pre-stop exec $DAEMON -s quit

Использование в качестве новомодного задания, обычным способом, с initctl start, initctl stop, и т.д.

, Конечно, люди уже сделали эти модификации давно.

Дополнительные материалы для чтения

4
ответ дан 26 July 2019 в 13:35

Другие вопросы по тегам:

Похожие вопросы: