Drupal 7: New image uploaded but Styles not created

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
rayster's picture

Comments

Perusio config files

EdPhillis's picture

Hi ray

Have you tried Perusio's set of config files? Image styles with nginx is a common issue. Sorry i havent had the time to read through all your links but I have had this problem before and Perusio's config files fixed it for me. If you are unable to implement then i am could probably dig out the relevant config stanza.

Hi Olomouc

rayster's picture

Thank you for the quick reply.

Are you referring to this: https://github.com/perusio/drupal-with-nginx

Any specific thing we should implement?

Or should we follow everything?

Thanks.

Perusio

EdPhillis's picture

Thats the one. Basically you should just follow the instructions there. There are various meta config files in etc/nginx/apps/drupal that you then reference in your site specific host config - drupal boost, https.

As per usual there will probably be a couple of issues. Run nginx -t to check your config and you might need to remove some entries from drupal.conf related to file types. This is one of my hosts files:

# -- mode: nginx; mode: flyspell-prog;  ispell-current-dictionary: american --
### Configuration for example.com.

## Return (no rewrite) server block.
##server {
    ## This is to avoid the spurious if for sub-domain name
    ## "rewriting".
  ##  listen 80; # IPv4
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
##    listen [fe80::202:b3ff:fe1e:8329]:80 ipv6only=on;
  ##  server_name www.stage.va.viva.org.uk;
  ##  return 301 $scheme://stage.va.viva.org.uk$request_uri;

#} # server domain return.

## HTTP server.
server {
    listen 80; # IPv4
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
    ## listen [fe80::202:b3ff:fe1e:8330]:80 ipv6only=on;

    server_name mysite.org.uk;
    limit_conn arbeit 32;

    ## Access and error logs.
    access_log /var/log/nginx/mysite_access.log;
    error_log /var/log/nginx/mysite_error.log;

    ## See the blacklist.conf file at the parent dir: /etc/nginx.
    ## Deny access based on the User-Agent header.
    if ($bad_bot) {
        return 444;
    }
    ## Deny access based on the Referer header.
    if ($bad_referer) {
        return 444;
    }

    ## Protection against illegal HTTP methods. Out of the box only HEAD,
    ## GET and POST are allowed.
    if ($not_allowed_method) {
        return 405;
    }

    ## Filesystem root of the site and index.
    root /var/www/sites/mysite.org.uk;
    index index.php;

    ## If you're using a Nginx version greater or equal to 1.1.4 then
    ## you can use keep alive connections to the upstream be it
    ## FastCGI or Apache. If that's not the case comment out the line below.
    fastcgi_keep_conn off; # keep alive to the FCGI upstream

    ## Uncomment if you're proxying to Apache for handling PHP.
    #proxy_http_version 1.1; # keep alive to the Apache upstream

    ################################################################
    ### Generic configuration: for most Drupal 7 sites.
    ################################################################
    include apps/drupal/drupal.conf;

    ################################################################
    ### Configuration for Drupal 7 sites to serve URIs that need
    ### to be escaped
    ################################################################
    #include apps/drupal/drupal_escaped.conf;

    #################################################################
    ### Configuration for Drupal 7 sites that use boost.
    #################################################################
    #include apps/drupal/drupal_boost.conf;

    #################################################################
    ### Configuration for Drupal 7 sites that use boost if having
    ### to serve URIs that need to be escaped
    #################################################################
    #include apps/drupal/drupal_boost_escaped.conf;

    #################################################################
    ### Configuration for updating the site via update.php and running
    ### cron externally. If you don't use drush for running cron use
    ### the configuration below.
    #################################################################
    #include apps/drupal/drupal_cron_update.conf;

    ################################################################
    ### Installation handling. This should be commented out after
    ### installation if on an already installed site there's no need
    ### to touch it. If on a yet to be installed site. Uncomment the
    ### line below and comment out after installation. Note that
    ### there's a basic auth in front as secondary ligne of defense.
    ################################################################
    include apps/drupal/drupal_install.conf;

    #################################################################
    ### Support for upload progress bar. Configurations differ for
    ### Drupal 6 and Drupal 7.
    #################################################################
    include apps/drupal/drupal_upload_progress.conf;

    ## Including the php-fpm status and ping pages config.
    ## Uncomment to enable if you're running php-fpm.
    #include php_fpm_status_vhost.conf;

    ## Including the Nginx stub status page for having stats about
    ## Nginx activity: http://wiki.nginx.org/HttpStubStatusModule.
    include nginx_status_vhost.conf;

}

Basically you will see that you are just referencing drupal.conf which does all the drupal specific stuff for you. The other important line is related to the install.conf.

Let me know if you need any more help. I have done drupal nginx configs more times than is healthy for my brain!

Module

rayster's picture

Could it that there is a module we are using that is causing the problem?

Hi

EdPhillis's picture

I doubt it. In that sense i would only think it would matter if you are running different versions of php. I have had a problem with feeds with nginx when getting data from an apache site to an nginx install but it was related to the different way that nginx and apache deal with escape characters.

this is the stanza from the perusio conf file.

    ## Drupal 7 generated image handling, i.e., imagecache in core. See:
    ## http://drupal.org/node/371374.
    location ~* /files/styles/ {
        ## Image hotlinking protection. If you want hotlinking
        ## protection for your images uncomment the following line.
        #include apps/drupal/hotlinking_protection.conf;
       #rewrite ^/([^+])+(.)$ /$1%20$2;
       access_log off;
        expires 30d;
        try_files $uri @drupal;
    }

This might also help..

https://klau.si/nginx-configuration-drupal

Imageinfo Cache

mikeytown2's picture

https://www.drupal.org/project/imageinfo_cache can generate image styles on upload