Jump to content

[SOLVED] nginx problem - Admin page not accessible


Recommended Posts

Hello Everyone,

i have been experiencing a weird problem since yesterday

 

I was trying to fix the issue with google analytics api where you get the message cannot retrieve test results

Reading solutions in the forum here i have added the allow_url_fopen = On to my php.ini

 

Since then i cannot access my admin page.

if i type www.website.com/admin1234 i get a prestashop 404 error.

the only way to access it is to add index.php like so: www.website.com/admin1234/index.php

 

Whats weird is that even if i delete or comment the allow_url_fopen line the problem remains

 

Im on a nginx server with prestashop 1.6.0.8

can anyone help me please?

 

thanks

Link to comment
Share on other sites

I resolved the issue!
I realized that i couldnt access the admin page directy after i recently added the following code for friendly URL to the nginx configuration file as in the documentation here http://doc.prestashop.com/display/PS16/System+Administrator+Guide
 

location / {
  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;
}

I fixed the issue removing the / before index.php at the top, I changed it to:

location / {
  index index.php;

and it works fine :)

I'm not an expert of code but now im not sure if the documentation is actually correct?
Cheers!!

  • Like 5
Link to comment
Share on other sites

thank you for information how you solved it.

im convinced that this post will be helpful for other merchants with the same problem on nginx software

 

so i decided to change topic title a little and mark it as solved

 

with regards,

Milos

Link to comment
Share on other sites

×
×
  • Create New...