Solved

Docker nginx permissions problem

Posted on 2014-12-12
5
1,175 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Two nodes for updates and forwarding 8 46
wordpress limitations 4 91
Webserver access problem 5 62
SSL sertificate 5 48
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now