Automatically start nginx webserver inside yocto

Hello,

I would like to automatically start nginx webserver inside yocto, by using SYSTEMD_AUTO_ENABLE and SYSTEMD_SERVICE_${PN}.

The file “nginx.service” is already created in the original nginx.bb recipe (where it does some sed ‘s’ operation to replace some /etc/ … locations).

I would like to create inside my layer a nginx.bbappend recipe and include:

SYSTEMD_SERVICE_${PN} += “nginx.service”
SYSTEMD_AUTO_ENABLE = “enable”

Is it possible ?

I tried already to include just the 2 above lines, but it does not work.

Should I include something more, maybe the “nginx.service” file under my “file” folder ?

Thanks,
Nicola

Hello Max,

yes, the SW version is morty. Nginx recipe version is 1.10.1.

Adding “inherit update-rc.d useradd systemd” to my .bbappend file made the trick.

Now the nginx service is enabled and starting with the Image.

Thanks again for your help !

Nicola

Hi

What versions of SW are we looking at?

Maybe you only miss the systemd bbclass as you likely use morty as this commit suggest?
So you could add ìnherit systemd` to your bbappend and try if that fixes the issue.

Max