Ispconfig 3 + nginx + prestashop rewrite = 500 Internal Server Error

Discussion in 'Installation/Configuration' started by hitri, Jun 18, 2013.

  1. hitri

    hitri New Member HowtoForge Supporter

    I'm using Ubuntu server 12.04LTS, nginx web server with Ispconfig 3 (The perfect server installation). I have installed Prestashop and when I turn on the rewrite function I got '500 Internal Server Error' (URL looks ok). I was looking for solution on all forums nothing works for me. Nginx looks like nightmare.
     
    Last edited: Jun 18, 2013
  2. ItsDom

    ItsDom New Member

  3. hitri

    hitri New Member HowtoForge Supporter

    I've seen this set up. It is not useful for Ispconfig configuration. I used only those nginx rewritw directives.
     
  4. ItsDom

    ItsDom New Member

    Okay. Is there anything in your log files?

    The part which handles the redirects in that guide is:

    Code:
    try_files $uri $uri/ /index.php$is_args$args;
    Make sure you set the directives through nginx (see example here http://www.howtoforge.com/forums/showpost.php?p=298814&postcount=4) and not by modifying the vhosts file as ISPConfig will overwrite it.
     
  5. hitri

    hitri New Member HowtoForge Supporter

    Thank you ItsDom.

    You are right, ispconfig rewrite directives in vhost configurations.

    Now it works, but images are not visible :confused:
     
  6. ItsDom

    ItsDom New Member

    No worries.

    Looking at the nginx directive from the tutorial, I'm guessing the bit to handle images is:

    Code:
           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;
    
    I could be wrong though - give it a try.

    If other bits still don't work, e.g. the API, have a look through the nginx directives given in the tutorial and transplant the bits you need into the "nginx directives" box in site options in ISPConfig.

    I'm not sure if the stuff above needs to go into a location container. I imagine not. Try it outside of the location container and if it throws up some errors, then put it in with the index directive.
     
  7. hitri

    hitri New Member HowtoForge Supporter

    ItsDom thank you very much, it works now :)
     

Share This Page