Я установил модуль Pagespeed для nginx, и после доступа к странице у меня есть все css, js и изображения, браузер выдает 404 not found.
pagespeed FileCachePath /var/cache/nginx/ngx_pagespeed;
pagespeed RewriteLevel PassThrough;
pagespeed EnableCachePurge on;
pagespeed PurgeMethod PURGE;
pagespeed EnableFilters collapse_whitespace,remove_comments,inline_css,inline_javascript,rewrite_css,rewrite_javascript;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
Сервер мой домен :
server {
server_name example.ru www.example.ru;
#ssl on;
ssl_certificate "/var/www/httpd-cert/example/example.ru.crtca";
ssl_certificate_key "/var/www/httpd-cert/example/example.ru.key";
ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
charset UTF-8;
index index.php;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/example.ru/*.conf;
access_log off;
error_log /dev/null crit;
ssi on;
set $root_path /var/www/example/data/www/example.ru;
root $root_path;
listen [2a00:f940:2:1:2::18af]:443 ssl;
listen 37.140.195.150:443 ssl;
include /etc/nginx/conf.d/pagespeed.inc;
pagespeed MapOriginDomain "http://localhost" "https://example.ru";
pagespeed LoadFromFile "https://example.ru" "/var/www/example/data/www/example.ru/";
#pagespeed Disallow "*.pagespeed.*";
pagespeed SslCertDirectory /etc/ssl/certs;
pagespeed SslCertFile /etc/ssl/certs/dhparam4096.pem;
gzip on;
gzip_comp_level 6;
gzip_disable "msie6";
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/rss+xml application/x-font-ttf application/x-font-woff application/x-font-woff2 font/opentype;
location ~* (\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt) {
deny all;
}
location ~* \/image.+(\.php) {
deny all;
}
location ~* \.(jpg|jpeg|gif|png|webp|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|woff|woff2|ttf|eof)$ {
add_header "Access-Control-Allow-Origin" "*";
add_header Cache-Control "public, max-age=31536000";
access_log off;
expires 31536000;
access_log off;
}
location = /sitemap.xml {
rewrite ^(.*)$ /index.php?route=extension/feed/google_sitemap last;
}
location = /googlebase.xml {
rewrite ^(.*)$ /index.php?route=extension/feed/google_base last;
}
location = /webmaster.rss {
rewrite ^(.*)$ /index.php?route=extension/payment/yandex_money/market last;
}
location /system {
rewrite ^/system/storage/(.*) /not_found last;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /xadmin123987 {
index index.php;
}
location / {
try_files $uri $uri/ @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
error_page 404 /not_found;
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@example.ru";
fastcgi_pass unix:/var/www/php-fpm/example.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
}
}
И Nginx conf:
user apache;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
load_module "modules/ngx_pagespeed.so";
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/vhosts/*/*.conf;
server {
server_name localhost;
disable_symlinks if_not_owner;
listen 80;
listen [::]:80;
include /etc/nginx/vhosts-includes/*.conf;
location @fallback {
error_log /dev/null crit;
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off ;
}
}
client_max_body_size 128m;
}
Буду признателен за любую помощь Nginx версия: 1.16.1 Версия Pages: 1.13.35.2-0 Сервер Nginx + PHP -FPM nginx ошибка скорости страницы 404