LINUX.ORG.RU

История изменений

Исправление Garcia, (текущая версия) :

еще вопрос, есть конфиг

server {
        listen 80;
        server_name example.com;
        root /var/www/example.com;
        index index.php index.html index.htm;
        access_log /var/log/nginx/example.com.access.log combined;
        error_log /var/log/nginx/example.com.error.log error;

        rewrite ^([^.]*[^/])$ $1/ permanent;

        location / {
                rewrite ^(.*)$ /public/$1 break;
                try_files $uri $uri/ /public/index.php?$query_string;
        }

        location ~ .php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass  unix:/var/run/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                fastcgi_buffer_size 128k;
                fastcgi_buffers 4 256k;
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
                root /var/www/example.com/public;
                access_log        off;
                expires           max;
        }

}

все вроде как работает, но на одной странице, в логах вижу

[error] 15817#15817: *13259 open() "/var/www/example.com/public/public/upload/images/news/11/4/screenshot-2.png" failed (2: No such file or directory), client: ip_client, server: example.com, request: "GET /public/upload/images/news/11/4/screenshot-2.png HTTP/1.1", host: "example.com", referrer: "https://example.com/articles/"
[error] 15817#15817: *13258 open() "/var/www/example.com/public/public/upload/images/news/12/7/2.jpg" failed (2: No such file or directory), client: ip_client, server: example.com, request: "GET /public/upload/images/news/12/7/2.jpg HTTP/1.1", host: "example.com", referrer: "https://example.com/articles/"

два раза public добавил, файлы лежат в

/var/www/example.com/public/upload/images/news/

как или что поправить, что бы нормально файлы он находил?

Исходная версия Garcia, :

еще вопрос, есть конфиг

server {
        listen 80;
        server_name example.com;
        root /var/www/example.com;
        index index.php index.html index.htm;
        access_log /var/log/nginx/example.com.access.log combined;
        error_log /var/log/nginx/example.com.error.log error;

        rewrite ^([^.]*[^/])$ $1/ permanent;

        location / {
                rewrite ^(.*)$ /public/$1 break;
                try_files $uri $uri/ /public/index.php?$query_string;
        }

        location ~ .php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass  unix:/var/run/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                fastcgi_buffer_size 128k;
                fastcgi_buffers 4 256k;
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
                root /var/www/example.com/public;
                access_log        off;
                expires           max;
        }

}

все вроде как работает, но на одной странице, в логах вижу

[error] 15817#15817: *13259 open() "/var/www/example.com/public/public/upload/images/news/11/4/screenshot-2.png" failed (2: No such file or directory), client: ip_client, server: example.com, request: "GET /public/upload/images/news/11/4/screenshot-2.png HTTP/1.1", host: "example.com", referrer: "https://example.com/articles/"
[error] 15817#15817: *13258 open() "/var/www/example.com/public/public/upload/images/news/12/7/2.jpg" failed (2: No such file or directory), client: ip_client, server: example.com, request: "GET /public/upload/images/news/12/7/2.jpg HTTP/1.1", host: "example.com", referrer: "https://example.com/articles/"

два раза public добавил, файлы лежат в

/var/www/example.com/public/upload/images/news/