4

I just transferred my Joomla installation to DigitalOcean and i'm running on nginx. Site seems to be running fine but when I login to the administrator portion and try to update something in the global configuration i get the following error:

2014/06/26 10:08:38 [error] 19654#0: *1035 FastCGI sent in stderr: "PHP message: PHP Warning:
file_put_contents(/usr/share/nginx/projects/hoopsforu/configuration.php): failed to open stream
: Permission denied in /usr/share/nginx/projects/hoopsforu/libraries/joomla/filesystem/file.php
 on line 426" while reading response header from upstream, client: 70.208.86.53, server: hoopsf
oru.com, request: "POST /administrator/index.php?option=com_config HTTP/1.1", upstream: "fastcg
i://127.0.0.1:9000", host: "hoopsforu.com", referrer: "http://hoopsforu.com/administrator/index
.php?option=com_config"
2014/06/26 10:08:38 [error] 19654#0: *1035 upstream sent invalid status "0 Could not write to t
he configuration file" while reading response header from upstream, client: 70.208.86.53, serve
r: hoopsforu.com, request: "POST /administrator/index.php?option=com_config HTTP/1.1", upstream
: "fastcgi://127.0.0.1:9000", host: "hoopsforu.com", referrer: "http://hoopsforu.com/administra
tor/index.php?option=com_config"

This is what my config looks like:

server {
    listen 80;
    server_name  hoopsforu.com www.hoopsforu.com;
    server_name_in_redirect off;

    root           /usr/share/nginx/projects/hoopsforu;
        index index.php index.html index.htm default.html default.htm;
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                        try_files $uri $uri/ /index.php?$args;
        }

        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                        return 403;
                        error_page 403 /403_error.html;
        }

        location ~ \.php$ {
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi.conf;
        }

        # caching of files
        location ~* \.(ico|pdf|flv)$ {
                        expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                        expires 14d;
        }
}
  • Are your directory permissions correct? It looks like a directory permissions error. it should be 644 and 755 for files and folders respectively, per this awnser : joomla.stackexchange.com/a/133/19 – ContextSwitch Jun 26 '14 at 15:17
  • @ContextSwitch I changed all permissions as per: stackoverflow.com/a/18817767/1086938 and still the same issue. – hanleyhansen Jun 26 '14 at 15:21
  • Can it be the .htaccess file? – hanleyhansen Jun 26 '14 at 15:23
  • no, nginx doesn't use the .htacess file, that's only apahce. – ContextSwitch Jun 26 '14 at 16:07
  • 2
    I'm not sure what user nginx uses (apache was apache) but check to make sure that the configuration.php's owner or grougp is set to that user or that user's group – ContextSwitch Jun 26 '14 at 16:08
4

Make sure your permissions are set to 644 and 755 for files and folders respectively. More on permissions can be found here: https://joomla.stackexchange.com/a/133/19

Also make sure the user or group is set to nginx so that nginx has permission to write to those files / directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.