Home > nginx > cannot write to nginx www folder

cannot write to nginx www folder

April 29Hits:4
Advertisement

I've recently installed nginx on my dev machine with Ubuntu 12.04.

I am currently logged in as myuser and after installing nginx I setup the following file permissions (nginx www folder was owned by root so I wanted to change that so I can edit files with myuser):

# add myuser to nginx group sudo usermod -a -G www-data myuser  # change ownership for www folder to nginx user (www-data) chown -R www-data:www-data /usr/share/nginx/www chmod -R 775 /usr/share/nginx/www 

Then I go to /usr/share/nginx/www and try to create a new folder/file. I always get Permission denied.

Here is a listing of the folder:

drwxrwxr-x 2 www-data www-data 4096 Apr 29 11:01 . drwxrwxr-x 3 www-data www-data 4096 Apr 29 11:01 .. -rwxrwxr-x 1 www-data www-data  383 Jul  7  2006 50x.html -rwxrwxr-x 1 www-data www-data  151 Oct  4  2004 index.html 

Everything seems to be fine here. The only thing weird I noticed is with the id command for myuser.

uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare) 

As you can see the groups www-data (id=33) is not shown with id command. But if I try

id -G myuser 1000 4 20 24 33 46 116 118 124 

With the latest command the group id 33 is displayed for myuser, which makes me think this user is actually in the www-data group.

Does anyone has an idea why I cannot write in the /usr/share/nginx/www folder as myuser ?

Answers

In order to get www-data group permissions you need to change the effective group of myuser.

Issue

newgrp www-data

and this should enable you to write in /usr/share/nginx/www.

It seems to me that the output of id will be updated (in Ubuntu) after you first change your group.

Related Articles

  • cannot write to nginx www folderApril 29

    I've recently installed nginx on my dev machine with Ubuntu 12.04. I am currently logged in as myuser and after installing nginx I setup the following file permissions (nginx www folder was owned by root so I wanted to change that so I can edit files

  • Nginx redirect folder to subdomainJune 5

    I'm trying to configure a redirect on Nginx from a folder to a subdomain. I've tried already Nginx redirect: folder to external domain and Nginx rewrite rule (subdirectory to subdomain) and nginx: redirect subfolder to subdomain. Nothing works. The p

  • How to take backup of nginx cache folder along with metadata?July 8

    I want to take a backup of nginx cache folder ( the proxy_cache_path ) and its metadata of the main server and use that as the cache folder of a secondary server. This is so that if the main server goes down the secondary server can take its place an

  • How do I make nginx's folder moveable?August 27

    Currently when I compile nginx (in directory /home/parth/nginx), it embeds the prefix supplied to configure script in the nginx binary. Now when I move that folder around (let's say to /tmp), it breaks with following error message. Is there a way to

  • How to change the Nginx default folder?September 2

    I setup a server with Nginx and i set my Public_HTML in - /home/user/public_html/website.com/public And its always redirect to - /usr/local/nginx/html/ How can i change this ? Nginx.conf - user www-data www-data; worker_processes 4; events { worker_c

  • Nginx complete folder protection not workingOctober 19

    I have installed nginx(1.4.3) with PHP-FPM(5.4.20). i want to protect my wordpress wp-admin folder. my nginx configuration file domain.conf: server { listen 80; server_name example.com; root /var/www; location / { index index.php; try_files $uri $uri

  • Disable Gateway Timeout for Specific Nginx Port / FolderApril 17

    How can I disable the nginx timeout when accessing through a specific port, or simply a specified folder. Whichever is easier. Basically I have some scripts which need to execute for a long period of time and the gateway timeout is preventing them fr

  • How to check nginx root folderAugust 18

    I have a very basic 404 error: Description: HTTP 404.The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is

  • nginx git folder requestJanuary 10

    Im using nginx and git-web and it works great. I access my site using www.mydomain.org to pull up gitweb. Here is my config file: server { listen 80 default_server; listen [::]:80 default_server; server_name www.mydomain.org; return 301 https://$serv

  • Nginx: Rewrite folder to folder2June 26

    I need to do a simple rewrite, and can't find out how. Rewrite "http://example.com/"index.php/administrator/catalog_product/new/"dumpidum" to "http://example.com/"index.php/administrator/catalog_product/new/set/4/type/simple/

  • Domain points to nginx root folder instead of /var/www/mydomain/webSeptember 3

    After adding and configuring domain in ISPconfig it shows the files from Code: /usr/share/nginx/html/ instead of Code: /var/www/mydomain/web What can be the reason of such issue? Any advice or reference about this would be greate, Thank you! --------

  • nginx proxy folder to urlMay 29

    I have some sites I want to redirect with nginx: domain.com:1180 -> test.domain.com (static site) domain.com:1280 -> test.domain.com/promo (meteor.js website) On domain.com I have an nginx server with the following site enabled: server { listen 80;

  • nginx sub-folder with separated rootJanuary 24

    I have a little problem. I have a wordpress installation in /var/www/xyz/wordpress and now I want to have a piwik installation in the path /var/www/xyz/piwik My current nginx configuration looks like this: server { ... root /var/www/xyz/wordpress; in

  • Nginx - Deny folder, except subfolders with regexSeptember 10

    I want to deny access to anything in the app directory, except in subfolders with an Assets folder. For example: Allow these files /app/bundles/ApiBundle/Assets/css/Thing.js /app/bundles/AssetsBundle/Assets/css/mautic.css Deny these: ``` /app/bundles

  • WP Permalinks won't work without DNS in nginx (ip/folder)November 4

    I am trying to access some of my websites via http://ip.add.re.ss/domain.com so my client can update the website content BEFORE putting it online (pointing the DNS) The website is stored in /var/www/domain.com. The frontpage loads ok, but none of the

  • Nginx protected folderJanuary 8

    Hello, Im trying to protect some pdf files with the built-in protected folder settings on a client website. if I look at the .vhost file for the website I got following lines added: Code: location /images/dokumentation/ { auth_basic "Members Only&quo

  • Nginx redirect: folder to external domainJune 10

    I'm trying to redirect domain1.com/blog/$ to domain2.com/$. How do I edit this to strip the /blog from the redirect? location /blog { rewrite ^/(.*) http://domain2.com/$1 break; } It now redirects domain1.com/blog/blabla to domain2.com/blog/blabla (s

  • nginx rewrite folder http to httpsFebruary 26

    I currently have 2 server containers, 1 for http, and another for the same server but https. I want to merge those containers using Listen 80; and Listen 443 ssl;, which works but I need to rewrite a URL different now: location ^~ /wp-admin { rewrite

  • Nginx + Passenger, getting truncated responsesNovember 23

    Getting truncated responses for big attachments in Redmine, served by Nginx + Passenger. Error log says like following: [ pid=11234 thr=3070954384 file=ext/nginx/HelperAgent.cpp:568 time=2010-11-23 16:05:29.414 ]: Couldn't forward the HTTP response b

  • Nginx : Add/Enable mp4 moduleDecember 19

    Is there a way to enable this module on nginx ? http://wiki.nginx.org/HttpMp4Module I have already many domains running on nginx and I can't just remove it and rebuilt everything . I tried downloading latest nginx, and do ./configure --with-http_mp4_

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.287 s.