Tips – Nginx and upload

Cli

$ sudo lsof -p NGINXPID
$ sudo lsof -p 671 |grep deleted
nginx   671 www-data   45u      REG              202,1 3354454820               393379 /var/lib/nginx/body/0000000005 (deleted)
$ sudo lsof | grep body
 nginx       671       www-data   45u      REG              202,1 1556957988               393379 /var/lib/nginx/body/0000000005 (deleted)

nginx.conf

client_body_temp_path /var/lib/nginx/body;

/var/lib/nginx/body

Nginx save temporary upload files in this folder.

Sources:

https://github.com/Chocobozzz/PeerTube/issues/1423#issuecomment-454267626

“iwascraig commented on Jan 15
I have this problem also .. not related to CPU size.. the problem is related to upload file size…
my /var/lib/nginx/body folder is on a system volume that is only 10GB in size… when I try to upload a 15GB file (research data, often this large or larger) I run out of space and client gets error.”

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path

Pure-ftpd and PureDB

apt install -y pure-fptd

ln -s ../conf/PureDB /etc/pure-ftpd/auth/50pure

echo no > /etc/pure-ftpd/conf/PAMAuthentication

id -u www-data > /etc/pure-ftpd/conf/MinUID

pure-pw useradd myuser -u www-data -g www-data -d /var/www/mysite.com -m

pure-pw mkdb

systemctl restart pure-ftpd

Nginx and RTMP

Download source

# apt-get source nginx
# git clone https://github.com/arut/nginx-rtmp-module.git

Install depends

# apt-get build-dep nginx
# apt install dpkg-dev

Change debian/rules

# nano debian/rules

at line start with: extras_configure_flags
add:

–add-module=/root/nginx/nginx-rtmp-module

tried, but failed:
–add-dynamic-module=/root/nginx/nginx-rtmp-module

Build package

# dpkg-buildpackage -us -uc

Install packages

# dpkg -i libnginx-mod-http-auth-pam_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-cache-purge_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-dav-ext_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-echo_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-fancyindex_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-geoip_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-headers-more-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-image-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-lua_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-perl_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-subs-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-uploadprogress_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-upstream-fair_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-xslt-filter_1.10.3-1+deb9u2_amd64.deb libnginx-mod-mail_1.10.3-1+deb9u2_amd64.deb libnginx-mod-nchan_1.10.3-1+deb9u2_amd64.deb libnginx-mod-stream_1.10.3-1+deb9u2_amd64.deb libnginx-mod-http-ndk_1.10.3-1+deb9u2_amd64.deb nginx-common_1.10.3-1+deb9u2_amd64.deb

Hold packages

# dpkg -l | grep nginx|cut -d " " -f 3|while read pkg ; do apt-mark hold $pkg;done

Referencias

  • https://johnathan.org/originals/2016/07/add-rtmp-support-to-nginx-installed-from-apt.html