Jump to content

Error 404 Nginx Wordpress permalinks


BonCev

Recommended Posts

J'ai un server dedié Ubuntu qui utilise Plesk avec Nginx pour faire fonctionner Prestashop 1.6.
J4ai recement installé wordpress dans un sous-repertoire, mais les permalinks de wordpress ne fonctionnent pas.

J'ai trouvé cette doc mais je ne sais pas comment l'utiliser.
https://www.conetix.com.au/support/article/how-enable-rewrite-rules-plesk-125-nginx
https://kb.plesk.com/en/126908

Voila ma config additionnelle dans plesk :
/********************************************************/
proxy_buffer_size 256k;
proxy_buffers 16 512k;
proxy_busy_buffers_size 512k;
fastcgi_buffer_size 32k;
fastcgi_buffers 16 12k;

location ^~ /fr/ {
index /index.php;

rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$1$2.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$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])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last;
rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+.jpg$ /img/c/$1.jpg last;
rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last;
try_files $uri $uri/ /index.php?$args;
}

location ^~ /en/ {
#rewrite ^(.*)$ /index.php?q=$1 last;
try_files $uri $uri/ /index.php?$args;
}
location ^~ /de/ {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /es/ {
#rewrite ^(.*)$ /index.php?q=$1 last;
try_files $uri $uri/ /index.php?$args;
}

# Pass API requests to the webservice dispatcher
location ^~ /api/ {
rewrite ^/api/(.*) /webservice/dispatcher.php?url=$1 last;
}
# Block all files starting with ., like .htaccess
location ~ /\. {
deny all;
}
# Block all files with these extensions
location ~ \.(md|tpl)$ {
deny all;
}
# Directories explicitly allowed in directories blocked below
location ~ ^/docs/csv_import/ {
allow all;
}
# Block everything else in these directories
location ~ ^/(config|docs|download|install666|localization|log|override|tools|translations)/ { deny all;
}
# 1 month expiry on other static stuff
# Also do the friendly URL rewrites
location ~* \.(eot|gif|ico|jpg|jpeg|otf|pdf|png|svg|swf|ttf|woff)$ {
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg break;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg break;
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 break;
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 break;
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 break;
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 break;
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 break;
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 break;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg break;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg break;
rewrite ^/images_ie/?([^/]+)\.(jpeg|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 break;
expires 1M;
add_header Cache-Control public;
allow all;
}
# Block everything else in these directories
location ~ ^/img/cms/ {
deny all;
}
# 1 week expiry on CSS and JavaScript
location ~ \.(css|js)$ {
expires 1w;
add_header Cache-Control public;
allow all;
}

#
gzip on;
gzip_disable “MSIE [1-6]\.(?!.*SV1)”;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
gzip_vary on;
#
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
try_files $uri =404;
}
/******************************************/

Quelqu'un peut m'aider ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...