Prestashop nginx 类别 404
Prestashop nginx Categories 404
我尝试用 nginx 配置我的 Prestashop。
除类别外,一切正常。我有一些友好的 URL 重写:
{类别:/}{重写}/
赞:我的url.com/fuellmaterial/
Nginx 给我该类别网站的 404。问题是服务器将 "index.html" 添加到 url,我可以在 error.log
中看到
错误 404 GET /fuellmaterial/ HTTP/1.1 SSL/TLS-Zugriff für nginx
错误 15130#0: *1295 "/var/www/vhosts/myurl.com/httpdocs/fuellmaterial/index.html" 未找到(2:没有那个文件或目录)nginx-Fehler
如何删除类别的 index.html?有什么想法吗?
谢谢
此配置应该像在我们的 PHP 7 / Nginx / Presta 1.6 生产配置上一样工作,不要忘记取消注释并根据您的需要进行编辑,例如 SSL 配置:
server {
listen *:80;
#listen *:443 ssl;
#ssl_certificate /root/etc/letsencrypt/live/www.domain.tld/fullchain.pem;
#ssl_certificate_key /root/etc/letsencrypt/live/www.domain.tld/privkey.pem;
server_name www.domain.tld;
access_log /var/log/nginx/www.domain.tld.access.log;
error_log /var/log/nginx/www.domain.tld.error.log;
root /var/www/www.domain.tld;
index index.html index.htm index.php;
client_max_body_size 60M;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url= last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p//.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p///.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p//////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p///////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p////////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/////////.jpg last;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/.jpg last;
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/. last;
try_files $uri $uri/ /index.php$is_args$args;
error_page 404 /index.php?controller=404;
#ssl_session_timeout 24h;
#ssl_session_cache shared:SSL:10m;
#ssl_dhparam /etc/ssl/dhparam.pem;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:RSA+3DES:AES128-SHA:!ADH:!AECDH:!MD5;
#ssl_prefer_server_ciphers on;
#ssl_stapling on;
#ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=31536000;
resolver 127.0.0.1;
location ~* \.(eot|ttf|woff|eof|woff2|css|js|jsonp|jpg|jpeg|gif|png|ico|svg|webm|mp3|mp4)$ {
add_header Access-Control-Allow-Origin *;
# ~ 10 Days
expires 604800s;
}
location ~ \.tpl {
deny all;
}
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
include fcgi.conf;
# depending on version, could be : include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
我尝试用 nginx 配置我的 Prestashop。 除类别外,一切正常。我有一些友好的 URL 重写:
{类别:/}{重写}/
赞:我的url.com/fuellmaterial/
Nginx 给我该类别网站的 404。问题是服务器将 "index.html" 添加到 url,我可以在 error.log
中看到错误 404 GET /fuellmaterial/ HTTP/1.1 SSL/TLS-Zugriff für nginx
错误 15130#0: *1295 "/var/www/vhosts/myurl.com/httpdocs/fuellmaterial/index.html" 未找到(2:没有那个文件或目录)nginx-Fehler
如何删除类别的 index.html?有什么想法吗?
谢谢
此配置应该像在我们的 PHP 7 / Nginx / Presta 1.6 生产配置上一样工作,不要忘记取消注释并根据您的需要进行编辑,例如 SSL 配置:
server {
listen *:80;
#listen *:443 ssl;
#ssl_certificate /root/etc/letsencrypt/live/www.domain.tld/fullchain.pem;
#ssl_certificate_key /root/etc/letsencrypt/live/www.domain.tld/privkey.pem;
server_name www.domain.tld;
access_log /var/log/nginx/www.domain.tld.access.log;
error_log /var/log/nginx/www.domain.tld.error.log;
root /var/www/www.domain.tld;
index index.html index.htm index.php;
client_max_body_size 60M;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url= last;
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p//.jpg last;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p///.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p//////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p///////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p////////.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/////////.jpg last;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/.jpg last;
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/. last;
try_files $uri $uri/ /index.php$is_args$args;
error_page 404 /index.php?controller=404;
#ssl_session_timeout 24h;
#ssl_session_cache shared:SSL:10m;
#ssl_dhparam /etc/ssl/dhparam.pem;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:RSA+3DES:AES128-SHA:!ADH:!AECDH:!MD5;
#ssl_prefer_server_ciphers on;
#ssl_stapling on;
#ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=31536000;
resolver 127.0.0.1;
location ~* \.(eot|ttf|woff|eof|woff2|css|js|jsonp|jpg|jpeg|gif|png|ico|svg|webm|mp3|mp4)$ {
add_header Access-Control-Allow-Origin *;
# ~ 10 Days
expires 604800s;
}
location ~ \.tpl {
deny all;
}
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
include fcgi.conf;
# depending on version, could be : include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}