How to recompile Nginx with changes?
I'm using Nginx with MySQL, PHP and Laravel if that matters. Basically when I print something to the error log like the following:
If $long_str is long enough it gets cut off. I'm using this for debugging purposes and this worked fine when I was working in Apache so I think it may have something to do with Nginx.
I've tried changing…
log_errors_max_len = 1024
log_errors_max_len = 60000
in both /etc/php5/cli/php.ini and /etc/php5/fpm/php.ini
But it didn't do anything. After googling around a bit I found:
"There is a hard-coded length limitation on the error messages in the Nginx core. It is 2048 bytes at most, including the trailing newlines and the leading timestamps. You can manually modify this limit by modifying the NGXMAXERRORSTR macro definition in the src/core/ngxlog.h file in the Nginx source tree. If the message size exceeds this limit, the Nginx core will truncate the message text automatically."
I currently have Nginx already installed on my Linode. So that brings me to the question, how can I modify this src/core/ngx_log.h file, as it doesn't seem to be on my Linode, and recompile?
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep nginx
apt-get source nginx
nano src/core/ngx_log.h (make whatever change)
nano debian/changelog (write a changelog entry explaining what you did, increase version number by 0.5)
dpkg-buildpackage -uc -us
Then you either use "dpkg -i" to install the new packages or put them in a private repository to be installed with apt-get install.
Wish you luck.
I'm using Ubuntu and will be trying out what you suggested really soon. I'm assuming that I would have to shut down nginx before installing it correct? I've never done this before so I'm thinking I should back up everything before I give it a go.