Automatically start nginx webserver inside yocto


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 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”

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 ?


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 !



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.