V
V
Vladimir2013-11-18 06:59:52
Nginx
Vladimir, 2013-11-18 06:59:52

Help with nginx config

There is an nginx config for CMS joomla

server {
        server_name subdomain.domain.ru;
        server_name_in_redirect off;

        root /var/www/domain/subdomain;
        index index.php index.html index.htm default.html default.htm;

        location ~ /plugins/content/jumultithumb/img/(.*).jpg$ {
            #deny all;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index img.php;
            fastcgi_buffers 8 64k;
            fastcgi_buffer_size 128k;
            fastcgi_param SCRIPT_FILENAME $document_root/plugins/content/jumultithumb/img/img.php?src=$1;
            include fastcgi_params;
        }

        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 unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_buffers 8 64k;
            fastcgi_buffer_size 128k;
            fastcgi_param SCRIPT_FILENAME $document_root/index.php?$query_string;
            include fastcgi_params;
        }

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

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }

There is a jumultithumb plugin for joomla, earlier on Apache everything worked fine in the img folder there was .htaccess :
RewriteEngine on
RewriteRule ^([^_]*)\.jpg$ img.php?src=$1 [L]
Location works, checked deny all;
But it still does not work as it should, it writes in the file with errors
[error] 22367#0: *565 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 8.8.8.8, server: moruch.kholmsk.ru, request: "GET /plugins/content/jumultithumb/img/Li4vLi4vLi4vLi4vaW1hZ2VzL21vcnVjaDI0MHgxMjAuZ2lmJnc9MjIwJmg9MTIwJnE9OTAmYW9lPTE=.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Unger, 2013-11-18
@merdoc

Add
rewrite ^/plugins/content/jumultithumb/img/([^_]*)\.jpg$ /img.php?src=$1 break;
in location /
A location ~ /plugins/content/jumultithumb/img/(.*).jpg$ - remove

V
Vladimir, 2013-11-18
@merdoc

It turned out to be done

location ~ /plugins/content/jumultithumb/img/(.*).jpg$ {
            rewrite ^/plugins/content/jumultithumb/img/([^_]*)\.jpg$ /plugins/content/jumultithumb/img/img.php?src=$1 last;
        }

Thank you very much for the tip cobalt'y

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question