nginxconfig.io
nginxconfig.io copied to clipboard
nginx test fails when nginxconfig.io url exceeds length limit
Steps to reproduce
- Create a configuration whose
digitalocean.com/community/tools/nginxURL is over 5000 characters in length. - Import the configuration into
/etc/nginx - Run
nginx -t
Error occurs
nginx: [emerg] too long parameter "# https://..."
nginx: configuration file /etc/nginx/nginx.conf test failed
Workaround
Yank & delete the comment and put into /etc/nginx/nginxconfig.io.url.
Run nginx -t again, the check is successful, and the service starts correctly.
Suggested solution
Store the URL in a separate file, similar to the workaround, instead of writing to nginx.conf.
https://github.com/digitalocean/nginxconfig.io/blob/2eac584166e8c5ba095322386533ddd9a0272b8b/src/nginxconfig/generators/conf/nginx.conf.js#L37
Storing the URL in a separate file has a number of other benefits, when deploying a configuration:
- Cleaning up
nginx.conf, so that the user doesnt have to scroll 10 wrapped lines of URL before reading the actual configuration. - Can easily copy the URL, with only
catavailable. - Solving the bug I am reporting
Maybe I can make a PR about this, let me check some things:
Instead of:
# Generated by nginxconfig.io
# https://www.digitalocean.com/community/tools/nginx?global.security.limitReq=true
You recommend:
# Generated by nginxconfig.io
# See URL.md to get the configuration shared link
And in URL.md
Configuration shared link of nginxconfig.io:
https://www.digitalocean.com/community/tools/nginx?global.security.limitReq=true
That's correct? @ProphetLamb Opinitions? @MattIPv4
I would suggest writing the URL to a dedicated nginxconfig.txt file, and just the URL (not an MD file with additional text)
nginxconfig.txt
https://www.digitalocean.com/community/tools/nginx?global.security.limitReq=true
Is correct?