nginx: not starting after setting access log "disabled"

Started by Tubs, May 11, 2019, 06:15:08 AM

Previous topic - Next topic
Hello,

Nginx is not starting after setting of access log in section srver to "disabled".

My setup with nginx as reverse proxy is running. When I change in nginx server settings access log from "Standard" to "Disabled" in the first step looks like all is working fine. Nginx is running. But after reboot of OPNsense box nginx is not starting any more.

In error.log I found:
2019/05/11 12:52:00 [emerg] 51023#100211: unknown log format "disabled" in /usr/local/etc/nginx/nginx.conf:1519

In nginx.conf I found
access_log  /var/log/nginx/xxxxxxx.de.access.log disabled;

To me it looks like after reboot of opnsense the nginx conf is getting rewiritten but the fomat is not correct.

try "opnsense-patch -c plugins 8022abc0bfd7daff8428d67791de8529c89576b9" to fix it.

See:https://github.com/opnsense/plugins/pull/1334/files

Fabian is always a little mean, you can abbreviate the hash after 7-10 characters for convenience ;)

# opnsense-patch -c plugins 8022abc0


Cheers,
Franco

We are on the right track but looks like it was not working on my machine.

# opnsense-patch -c plugins 8022abc0bfd7daff8428d67791de8529c89576b9
Fetched 8022abc0bfd7daff8428d67791de8529c89576b9 via https://github.com/opnsense/plugins
1 out of 1 hunks failed while patching opnsense/service/templates/OPNsense/Nginx/http.conf

I checked the file.
On my machine it is different as the patch is expecting:

/usr/local/opnsense/service/templates/OPNsense/Nginx/http.conf
{% if server.charset is defined %}
    charset {{ server.charset }};
{% endif %}
    access_log  /var/log/nginx/{{ server.servername }}.access.log {{ server.access_log_format }};
    access_log  /var/log/nginx/tls_handshake.log handshake;
    error_log  /var/log/nginx/{{ server.servername }}.error.log;
{% if server.root is defined and server.root != '' %}
    root "{{server.root}}";
{% endif %}
{% if server.max_body_size is defined %}
    client_max_body_size {{ server.max_body_size }};
{% endif %}
{% if server.body_buffer_size is defined %}
    client_body_buffer_size {{ server.body_buffer_size }};
{% endif %}
{% if server.satisfy is defined %}
    satisfy {{ server.satisfy }};
{% endif %}



The error is probably because the patch is for plugin version 1.12 and you are missing some other previous patches.

The file is placed here and you can edit it using vim after installation(pkg install vim-lite) or down- and upload it using scp/sftp: /usr/local/opnsense/service/templates/OPNsense/Nginx/http.conf
In your case, just omit the syslog stuff as it is not in version 1.11.

Please keep in mind that if you mistype the config, you may end up with a template failure. so please check it afterwards by running "configctl template reload OPNsense/Nginx". If this works the patch is successfully applied and the UI will work again too.

Thanks a lot. It looks like now nginx with disabled loggin is working.

Yes, I am using os-nginx 1.11_2 what I assume is the patch level of 19.1.7. Nothing newer is visible for me on production update channel.

I copied the file and applied the patch. syslog I kept untouched.

PS:
I used SFTP client via Windows PC. This was more convinient than cli.