I've run into a weird issue. I have a custom configured and compiled version of NGINX (I wanted a couple extra compile time modules installed). For whatever reason, it's creating client_temp
as a file rather than a directory, and that's causing a 500 internal server error whenever I try uploading a file.
My configuration:
--prefix=/opt/nginx --sbin-path=/usr/local/sbin/nginx
--conf-path=/opt/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=www-data --group=www-data
--with-http_ssl_module --with-http_realip_module
--with-http_gunzip_module --with-http_gzip_static_module --with-threads --with-file-aio
--with-ipv6 --with-http_v2_module
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=native' --add-module=../ngx_cache_purge-2.3
--add-module=../headers-more-nginx-module --add-module=../ModSecurity-nginx
As you can see, I do specify a path for client_temp
: --http-client-body-temp-path=/var/cache/nginx/client_temp
, yet it's a file rather than a directory.
Do I need to manually create client_temp
as a directory and remove the file? Or is there another way to remedy the situation?
In these cases, its sometimes easier/better to create the
client_temp
directory first, and set its permissions/ownership, and then launch the Nginx service. This will insure the folder exists, and its permissions set is appropriate for accepting uploaded files.