How to use native nginx configuration files

Hello!
I want to use Nginx in my openwrt device,I have found this doc,but I think the configuration is complex,I want to write a native nginx.conf, seems like /etc/config/nginx will automatically generate nginx configuration at /etc/nginx/.

Is below two ways I can pick?

  • Leave /etc/config/nginx empty, and write the nginx.conf myself, put it at /etc/nginx/nginx.conf?
  • Use another package, the pre-built nginx binary,where I can find it?

This is how I did it, hope this helps.

My uci configuration file is almost empty:

root@router:~# cat /etc/config/nginx 

config main global
	option uci_enable 'false'

Then, everything else is where NGINX expects it:

root@router:~# ls -lR /etc/nginx/
/etc/nginx/:
drwxr-xr-x    2 root     root          3488 Oct  2  2022 conf.d
-rw-r--r--    1 root     root          1007 Oct  2  2022 fastcgi_params
drwxr-xr-x    2 root     root          3488 Oct  2  2022 hass
drwxr-xr-x    2 root     root          3488 Oct  2  2022 home
-rw-r--r--    1 root     root          2837 Oct  2  2022 koi-utf
-rw-r--r--    1 root     root          2223 Oct  2  2022 koi-win
-rw-r--r--    1 root     root          5231 Oct  2  2022 mime.types
-rw-r-----    1 root     root          5798 Oct  2  2022 naxsi_core.rules
-rwxr-xr-x    1 root     root           798 Oct 28  2022 nginx.conf
-rw-------    1 root     root           183 Oct  2  2022 restrict_locally
-rw-r--r--    1 root     root           636 Oct 30  2021 scgi_params
lrwxrwxrwx    1 root     root            23 Oct  2  2022 uci.conf -> /var/lib/nginx/uci.conf
-rw-------    1 root     root           699 Oct  2  2022 uci.conf.template
-rw-r--r--    1 root     root           664 Oct  2  2022 uwsgi_params
-rw-r--r--    1 root     root          3610 Oct  2  2022 win-utf

/etc/nginx/conf.d:
-rw-r--r--    1 root     root           741 Oct  2  2022 _lan.crt
-rw-------    1 root     root           288 Oct  2  2022 _lan.key
-rw-r--r--    1 root     root           434 Oct 28  2022 default.conf
-rw-r--r--    1 root     root          1074 Oct 28  2022 hass.conf
-rw-r--r--    1 root     root           748 Oct 28  2022 home.conf
-rw-------    1 root     root           173 Oct  2  2022 luci.conf
-rw-------    1 root     root           552 Oct  2  2022 luci.locations
-rw-r--r--    1 root     root           172 Oct 28  2022 proxy.conf

/etc/nginx/hass:
-rw-r--r--    1 root     root          1850 May 30 00:00 cert.pem
-rw-r--r--    1 root     root          5601 May 30 00:00 fullchain.pem
-rw-------    1 root     root          1675 May 30 00:00 key.pem

/etc/nginx/home:
-rw-r--r--    1 root     root          1850 May 30 00:00 cert.pem
-rw-r--r--    1 root     root          5601 May 30 00:00 fullchain.pem
-rw-------    1 root     root          1679 May 30 00:00 key.pem
2 Likes

I am more radical:
rm /etc/config/nginx
rm /etc/init.d/nginx
rm /etc/rc.d/{S/K}..nginx
on first boot. Or in rc.local . Or ..

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.