Jump to content

Edit History

Castris

Castris


Solved

More than 12 hours looking for the solution to have a multi-language store, in a Plesk Odin environment, based on Nginx server (without apache) + FPM

Dozens of posts in google, and no solution.

On my stage, and in order not to disturb my client, who insists (I do not know why) on using a Plesk control panel, I created in a VPS development, a fresh installation of Plesk, with a prestashop 1.7.5.2

Once installed and tested, it worked perfectly in Apache mode, without using nginx

Activation of Nginx (Apache deactivation)

It works as long as there are no languages.

If there're languages all links show 

The page you are looking for was not found.

2.137.128.33 - - [21/May/2019:11:34:52 +0200] "GET /en/women/2-9-brown-bear-printed-sweater.html HTTP/1.1" 404 6876 "http://tamainut.info/en/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95"

I use a official nginx.conf.dist with adaptations to Plesk interface, beacuase Plesk is a intrusive panel. This use a nginx.conf  with call to vhost_nginx.conf (content below)

index index.php;

# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;

# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;

# Can be enhance to 5, but it can slow you server
# gzip_comp_level    5;
# gzip_min_length    256;

gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/ld+json
    application/manifest+json
    application/rss+xml
    application/vnd.geo+json
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/bmp
    image/svg+xml
    image/x-icon
    text/cache-manifest
    text/css
    text/plain
    text/vcard
    text/vnd.rim.location.xloc
    text/vtt
    text/x-component
    text/x-cross-domain-policy;

gzip_disable "MSIE [1-6]\.(?!.*SV1)";

# HSTS (Force clients to interact with your website using HTTPS only)
# For enhanced security, register your site here: https://hstspreload.org/
# WARNING: Don't use this if your site is not fully on HTTPS!
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always;

# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff(?:2)?)$ {
    add_header Access-Control-Allow-Origin *;
}

# Do not save logs for these
location = /favicon.ico {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

# [REQUIRED EDIT IF MULTILANG]
rewrite ^/es$ /es/ redirect;
rewrite ^/es/(.*) /$1;
rewrite ^/en$ /es/ redirect;
rewrite ^/en/(.*) /$1;


# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.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/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.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/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;

# [REQUIRED EDIT] Change this block to your admin folder
location /Backoffice/ {
    if (!-e $request_filename) {
        rewrite ^/.*$ /Backoffice/index.php last;
    }
}


# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
    deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
    deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
    deny all;
}

# Prevent injection of php files
location /upload {
    location ~ \.php$ {
        deny all;
    }
}
location /img {
    location ~ \.php$ {
        deny all;
    }
}

 

Testing site: https://tamainut.info

Apreciate your help.

Castris

Castris


Error un code

More than 12 hours looking for the solution to have a multi-language store, in a Plesk Odin environment, based on Nginx server (without apache) + FPM

Dozens of posts in google, and no solution.

On my stage, and in order not to disturb my client, who insists (I do not know why) on using a Plesk control panel, I created in a VPS development, a fresh installation of Plesk, with a prestashop 1.7.5.2

Once installed and tested, it worked perfectly in Apache mode, without using nginx

Activation of Nginx (Apache deactivation)

It works as long as there are no languages.

If there're languages all links show 

The page you are looking for was not found.

2.137.128.33 - - [21/May/2019:11:34:52 +0200] "GET /en/women/2-9-brown-bear-printed-sweater.html HTTP/1.1" 404 6876 "http://tamainut.info/en/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95"

I use a official nginx.conf.dist with adaptations to Plesk interface, beacuase Plesk is a intrusive panel. This use a nginx.conf  with call to vhost_nginx.conf (content below)

index index.php;

# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;

# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;

# Can be enhance to 5, but it can slow you server
# gzip_comp_level    5;
# gzip_min_length    256;

gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/ld+json
    application/manifest+json
    application/rss+xml
    application/vnd.geo+json
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/bmp
    image/svg+xml
    image/x-icon
    text/cache-manifest
    text/css
    text/plain
    text/vcard
    text/vnd.rim.location.xloc
    text/vtt
    text/x-component
    text/x-cross-domain-policy;

gzip_disable "MSIE [1-6]\.(?!.*SV1)";

# HSTS (Force clients to interact with your website using HTTPS only)
# For enhanced security, register your site here: https://hstspreload.org/
# WARNING: Don't use this if your site is not fully on HTTPS!
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always;

# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff(?:2)?)$ {
    add_header Access-Control-Allow-Origin *;
}

# Do not save logs for these
location = /favicon.ico {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

# [REQUIRED EDIT IF MULTILANG]
rewrite ^/es$ /es/ redirect;
rewrite ^/es/(.*) /$1;
rewrite ^/en$ /es/ redirect;
rewrite ^/en/(.*) /$1;


# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.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/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.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/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;

# [REQUIRED EDIT] Change this block to your admin folder
location /Backoffice/ {
    if (!-e $request_filename) {
        rewrite ^/.*$ /Backoffice/index.php last;
    }
}


# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
    deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
    deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
    deny all;
}

# Prevent injection of php files
location /upload {
    location ~ \.php$ {
        deny all;
    }
}
location /img {
    location ~ \.php$ {
        deny all;
    }
}

 

Testing site: https://tamainut.info

Apreciate your help.

Castris

Castris

More than 12 hours looking for the solution to have a multi-language store, in a Plesk Odin environment, based on Nginx server (without apache) + FPM

Dozens of posts in google, and no solution.

On my stage, and in order not to disturb my client, who insists (I do not know why) on using a Plesk control panel, I created in a VPS development, a fresh installation of Plesk, with a prestashop 1.7.5.2

Once installed and tested, it worked perfectly in Apache mode, without using nginx

Activation of Nginx (Apache deactivation)

It works as long as there are no languages.

If there're languages all links show 

The page you are looking for was not found.

2.137.128.33 - - [21/May/2019:11:34:52 +0200] "GET /en/women/2-9-brown-bear-printed-sweater.html HTTP/1.1" 404 6876 "http://tamainut.info/en/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95"

I use a official nginx.conf.dist with adaptations to Plesk interface, beacuase Plesk is a intrusive panel. This use a nginx.conf  with call to vhost_nginx.conf (content below)

index index.php;

# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;

# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;

# Can be enhance to 5, but it can slow you server
# gzip_comp_level    5;
# gzip_min_length    256;

gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/ld+json
    application/manifest+json
    application/rss+xml
    application/vnd.geo+json
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/bmp
    image/svg+xml
    image/x-icon
    text/cache-manifest
    text/css
    text/plain
    text/vcard
    text/vnd.rim.location.xloc
    text/vtt
    text/x-component
    text/x-cross-domain-policy;

gzip_disable "MSIE [1-6]\.(?!.*SV1)";

# HSTS (Force clients to interact with your website using HTTPS only)
# For enhanced security, register your site here: https://hstspreload.org/
# WARNING: Don't use this if your site is not fully on HTTPS!
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" preload; always;

# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff(?:2)?)$ {
    add_header Access-Control-Allow-Origin *;
}

# Do not save logs for these
location = /favicon.ico {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

# [REQUIRED EDIT IF MULTILANG]
rewrite ^/es$ /fr/ redirect;
rewrite ^/es/(.*) /$1;
rewrite ^/en$ /fr/ redirect;
rewrite ^/en/(.*) /$1;


# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.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/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.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/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;

# [REQUIRED EDIT] Change this block to your admin folder
location /Backoffice/ {
    if (!-e $request_filename) {
        rewrite ^/.*$ /Backoffice/index.php last;
    }
}


# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
    deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
    deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
    deny all;
}

# Prevent injection of php files
location /upload {
    location ~ \.php$ {
        deny all;
    }
}
location /img {
    location ~ \.php$ {
        deny all;
    }
}

 

Testing site: https://tamainut.info

Apreciate your help.

×
×
  • Create New...