Results 1 to 2 of 2

Thread: Nginx and Contao

  1. #1

    Default Nginx and Contao

    Hi,
    I'm testing Contao page on Nginx server but there is something wrong with base url.
    The base url is compiled like that: http://domain.com/domain.com instead of only http://domain.com.

    Has anybody experienced issue like that and what was the fix. Because when I've disable Nginx and used APACHE everything was OK.
    Web design agency - EDsolution.si Izdelava spletnih strani

  2. #2
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default Re: Nginx and Contao

    Out of the box, Contao + Nginx will fail with most URLs. As nginx doesn't support .htaccess you'll need to add rules within the server configuration for nginx.

    Taking the basic .htaccess and running it through a convertor for nginx I got:
    Code:
     if ($rule_0 = "1"){
                    return 403;
                    break;
            }   
            if ($uri ~* "(ftp|https?):|/etc/"){
                    set $rule_1 1$rule_1;
            }   
            if ($rule_1 = "1"){
                    return 403;
                    break;
            }   
            if (!-f $request_filename){
                    set $rule_2 1$rule_2;
            }   
            if (!-d $request_filename){
                    set $rule_2 2$rule_2;
            }   
            if ($rule_2 = "21"){
                    rewrite /.*.html$ /index.php last;
            }
    Not sure about the base url, I've had no trouble but then again the base url shouldn't be containing the domain but it's meant for relative paths...

    IMPORTANT
    Because of the move away from .htacess, ensure that you are protecting files correctly with nginx.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •