Jump to content

Prestashop 1.6.14 and NGINX 1.8.0


Recommended Posts

Dear All,

 

Today, I decide to install a fresh prestashop1.6.14 to my VSP. Everything work well until I turn on Friendly URL.

All my product pictures, categories picture don't show out.

 

when I inspect elements, i see the url is going wroing:

 

<img class="replace-2x img-responsive" src="http://goda.bonbonshop.vn/1-home_default/faded-short-sleeves-tshirt.jpg" alt="Faded Short Sleeves T-shirt" title="Faded Short Sleeves T-shirt" width="250" height="250" itemprop="image">

 

hmm, let see my directory structure:

Home/

       goda.bonbonshop.vn/

              public_html/ (all source code are in here.)

 

Please advice me on this case.

 

Thanks and best regards,

Ruc

 

Link to comment
Share on other sites

mod_rewrite is activated on your apache ? you should check your configuration file at /etc/apache2/sites-available/nameofyourconfigfile. The lines should look like this:

 <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>
  • Like 1
Link to comment
Share on other sites

Thanks for your suggestion,

 

but no luckily, I'm using NGINX, then I think even I make some change on Apache its also don't save me this way.

 

Anyone have any idea for my case.

 

I don't believe that, we cannot install Prestashop on server which run NGINX instead of Apache.

Link to comment
Share on other sites

Also using ngnix the instances are added before to apache. Ngninx is only proxied - this is the normal configuration. Or not in your configuration ?

 

Of course it is possible to install Prestashop on Apache/nginx architecture. I'm also running on nginx and Prestashop company itself also. So it works. But it needs knowledge on how to configure that. If your are the server admin of your server, you should search on the net for tutorials. There are several. I don't know how you installed/configured your architecture, so it is difficult to say do this or that. ;)

You are hosting where ? Some hosting companies do have good tutorials for their VPS or dedicated packages, or at least an own serveradmin forum.

 

You can try this configuration, direct on ngnix files: https://www.digitalocean.com/community/questions/enabling-nginx-mod_rewrite

 

or this

 

http://wiki.nginx.org/NginxHttpRewriteModule

 

or at least convert Prestashops  .htaccess to nginx and add it to conf.d with a converter: http://winginx.com/en/htaccess

Edited by selectshop.at (see edit history)
  • Like 1
Link to comment
Share on other sites

Thank you so much bro,

 

finally, i find it out. and it work for my by adding these line on my configuration files.

rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
       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;
       rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
       try_files $uri $uri/ /index.php$is_args$args;
       error_page 404 /index.php?controller=404;
       
       location ~* \.(gif)$ {
          expires 2592000s;
       }
       location ~* \.(jpeg|jpg)$ {
          expires 2592000s;
       }
       location ~* \.(png)$ {
          expires 2592000s;
       }
       location ~* \.(css)$ {
          expires 604800s;
       }
       location ~* \.(js|jsonp)$ {
          expires 604800s;
       }
       location ~* \.(js)$ {
          expires 604800s;
       }
       location ~* \.(ico)$ {
          expires 31536000s;
       }

Link to comment
Share on other sites

OK. BUT be careful ! if you install another software on your server, which is not Prestashop, you can get some troubles with the other software. That's why I wrote (at least) you can add the rewrite into conf.d. !!!

 

The better way is to debug the faulty configuration of your nginx.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

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...