I am newbie to Drupal and trying to install it on Gentoo/Linux with nginx web server.

However installer found an error of  "Requirements problem" - "The directory sites/default/files is not writable."

Please inform how to grant permissions to web server?

If any additional information is needed please let me know.


hiramanpatil’s picture

Go to the path - sites/default/ and execute below command.

chmod -R 777 /files

[Check if you required root user permission to execute this command)

drump’s picture

hiramanpatil Hi,

First I have done chmod -R 755 /files command as a root and got 2 errors:

"X  File system

Writable (public download method)
The directory sites/default/files is not writable"
"X Settings file
The Settings file is not writable.
The Drupal installer requires write permissions to ./sites/default/settings.php during the installation process."
After your tip command chmod -R 777 /files I get only one error:

X Settings file

The Settings file is not writable.
The Drupal installer requires write permissions to ./sites/default/settings.php during the installation process. The webhosting issues documentation section offers help on this and other topics.
Please advise if need to change permissions to  /sites/default/settings.php as well,
and if granting 777 is not too open to the world, in terms of security issues?
hiramanpatil’s picture

Yes, settings.php requires 777 permission while installation. Once you have set up Drupal site, you can reset settings.php file permissions to what is it now.


mchplumber’s picture

how can we set in ngnix server? it's not working. 

mmjvb’s picture

When you can't figure out why security setting don't do what is expected you are probably running SELinux. It is an additional layer of security.

drump’s picture

chmod 777 enabled the installation and afterward I chmod 755 again.

However now I get the first screen but can not log in - Please advise!

Here my nginx.conf:

user nginx nginx;
worker_processes 1;

error_log /var/log/nginx/error_log info;

events {
    worker_connections 1024;
    use epoll;

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main
        '$remote_addr - $remote_user [$time_local] '
        '"$request" $status $bytes_sent '
        '"$http_referer" "$http_user_agent" '

    client_header_timeout 10m;
    client_body_timeout 10m;
    send_timeout 10m;

    connection_pool_size 256;
    client_header_buffer_size 1k;
    large_client_header_buffers 4 2k;
    request_pool_size 4k;

    gzip on;
    gzip_min_length 1100;
    gzip_buffers 4 8k;
    gzip_types text/plain;

    output_buffers 1 32k;
    postpone_output 1460;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

        server_tokens off;

    keepalive_timeout 75 20;

    ignore_invalid_headers on;

    index index.php index.htm index.html;
        #index index.php; 

    server {
        # listen;
        server_name localhost;

        access_log /var/log/nginx/localhost.access_log main;
        error_log /var/log/nginx/localhost.error_log info;

    #    root /var/www/localhost/htdocs;
        #       root /var/www/localhost;
               root /var/www/localhost/htdocs/drupal;
                autoindex on;

        location ~ \.php$ {
                       # Test for non-existent scripts or throw a 404 error
                       # Without this line, nginx will blindly send any request ending in .php to php-fpm
#                      try_files $uri =404;
                       #try_files $uri $uri/ /index.php?q=$uri&$args;
                       include /etc/nginx/fastcgi.conf;
                       fastcgi_pass unix:/run/php-fpm.socket;


drump’s picture

It seems I found a solution and now can log in - found it here: 

https://www.drupal.org/node/1030854 at 

location / {
                # This is cool because no php is touched for static content
                try_files $uri $uri/ @rewrite;
                expires max;

   location @rewrite {
                # Some modules enforce no slash (/) at the end of the URL
                # Else this rewrite block wouldn't be needed (GlobalRedirect)
                rewrite ^/(.*)$ /index.php?q=$1;

Now need to work on the site and hope it will be ok :)

Thanks a lot