Solved

Docker nginx permissions problem

Posted on 2014-12-12
5
1,310 Views
Last Modified: 2014-12-12
After building...

FROM centos-7-nginx-es-export:latest

USER www-data

WORKDIR /etc/nginx

#ENTRYPOINT ["/opt/nginx-es-1.6.1-ssl1.0.1j/sbin/nginx"]
#CMD ['-c', "/etc/nginx/nginx.conf", '-g', "daemon off; client_body_temp_path /data/client_temp;"]

EXPOSE 80
EXPOSE 443


Running the following...

sudo docker run -v /var/log/nginx:/var/log/nginx:rw -v /etc/nginx/sites-enabled:/etc/nginx/sites-enabled:ro -i -t centos-7-nginx-es -c /etc/nginx/nginx.conf -g "daemon off;"

Yields...

nginx: [emerg] mkdir() "/opt/nginx-es-1.6.1-ssl1.0.1j/client_body_temp" failed (13: Permission denied)

How can I troubleshoot and correct this permissions problem?
0
Comment
Question by:bcex
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:Jan Springer
ID: 40496848
what do you see with:

   sudo docker info

?
0
 

Author Comment

by:bcex
ID: 40496853
:/usr/local/src/centos-7-nginx-es$ sudo docker info
Containers: 17
Images: 100
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 134
Execution Driver: native-0.2
Kernel Version: 3.13.0-40-generic
WARNING: No swap limit support
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 40496906
It's not a docker issue then.

Have you seen this document?:

https://wincent.com/wiki/Fixing_nginx_client_body_temp_permission_denied_errors
0
 

Author Comment

by:bcex
ID: 40497212
Hello Jan,

I did come across this page, however, the URL near "The directive required is client_body_temp_path and it's documented here." links to a site that is no longer active.  Do you have any insight as to the specific configuration changes required in order to remedy this?

Thank you
0
 
LVL 28

Accepted Solution

by:
Jan Springer earned 500 total points
ID: 40497290
Does this help?

http://stackoverflow.com/questions/21494979/file-upload-not-working-with-rails-4-in-development-using-pow-and-nginx

"The problem is not with Rails but with Nginx which is pretty evident from the nginx error.log. This question helped me understand what I was dealing with - Rails 3 + carrierwave + nginx = permission denied.

Nginx uses the client_body_temp_path directive to specify the location where it will temporarily store the uploaded files from the user request. Homebrew had set it by default to /usr/local/var/run/nginx. This folder also contains fastcgi_temp, proxy_temp, scgi_temp and uwsgi_temp for me. Nginx worker processes run with user nobody and they were not able to access these folders. I chowned all these folders to the nobody user, but that did not help.

Finally, I did

client_body_temp_path /tmp/nginx/; inside the HTTP module of my nginx.conf to make it work.

Doing a ls -l shows

drwx------  2 nobody       wheel   68 Feb  1 14:44 nginx

I am not sure why this worked inside /tmp and not inside the original /var/run/nginx. I belive I will face similar issue when I use other temp folders or in production. Will update this thread if and when that happens.

I recommend symlinking the other relevant logs like the nginx access and error log, pow access and app log to the /log directory of your Rails app. It helps in looking up errors in one of these when you face a tricky bug."
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question