concrete5 and Nginx

Discussion in 'HOWTO-Related Questions' started by calidan, Dec 30, 2012.

  1. calidan

    calidan New Member

    I am setting up concrete5 with nginx and I'm running into an issue with it being in a subdirectory instead of vhost. The error I'm getting is: concrete5 cannot parse the PATH_INFO or ORIG_PATH_INFO information provided by your server.

    I have the following setup in my location. Am I missing something? Thanks


    location ~ /concrete5/.*\.php$ {
    try_files $uri =404;​
    include fastcgi_params;​
    fastcgi_pass php5-fpm-sock;​
    fastcgi_index index.php;​
    set $script $uri;​
    set $path_info "/concrete5/";​
    if ($uri ~ "^(.+\.php)(/.+)") {​
    set $script $1;​
    set $path_info $2;​
    }​
    fastcgi_param URI $uri;​
    fastcgi_param PATH_INFO $path_info;​
    fastcgi_param SCRIPT_NAME $script;​
    fastcgi_param SCRIPT_FILENAME $document_root$script;​
    }
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Can you try this instead?

    Code:
    location /concrete5 {
      root /path/to/concrete5;
      index  index.html index.htm index.php;
      if (!-f $request_filename){
        set $rule_0 1$rule_0;
      }
      if (!-d $request_filename){
        set $rule_0 2$rule_0;
      }
      if ($rule_0 = "21"){
        rewrite ^/(.*)$ /index.php/$1 last;
      }
    
      location ~ \.php($|/) {
        try_files $uri =404;
        set  $script     $uri;
        set  $path_info  "";
        if ($uri ~ "^(.+\.php)(/.+)") {
          set  $script     $1;
          set  $path_info  $2;
        }
        fastcgi_pass unix:php5-fpm-sock;
        fastcgi_index  index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param  URI $uri;
        fastcgi_param  PATH_INFO        $path_info;
        fastcgi_param  SCRIPT_NAME      $script;
        fastcgi_param  SCRIPT_FILENAME  /path/to/concrete5$script;
      }
    }
     
  3. onastvar

    onastvar Member

    Hi Falko,

    I tried your suggestion, I'm unable to install Concrete5, I'm getting a red stop sign

    "Supports concrete5 request URLs"

    I'm unable to proceed with Concrete5 installation. Any ideas where and how I could start investigating the issue?

    Thank You
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Can you post the vhost configuration you're currently using?
     
  5. onastvar

    onastvar Member

    nginx Directives

    Code:
    location / {
                    try_files $uri $uri/ /index.php?$args;
               }
    
           # Add trailing slash to */wp-admin requests.
           rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
           location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
           }
    # Deny public access to wp-config.php
    location ~* wp-config.php { 
        deny all; 
    }
    
    location /phpmyadmin {
                   root /usr/share/;
                   index index.php index.html index.htm;
                   location ~ ^/phpmyadmin/(.+\.php)$ {
                           try_files $uri =404;
                           root /usr/share/;
                           fastcgi_pass 127.0.0.1:9000;
                           fastcgi_param HTTPS $fastcgi_https; # <-- add this line
                           fastcgi_index index.php;
                           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                           include /etc/nginx/fastcgi_params;
                           fastcgi_buffer_size 128k;
                           fastcgi_buffers 256 4k;
                           fastcgi_busy_buffers_size 256k;
                           fastcgi_temp_file_write_size 256k;
                           fastcgi_intercept_errors on;
                   }
                   location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                           root /usr/share/;
                   }
            }
            location /phpMyAdmin {
                   rewrite ^/* /phpmyadmin last;
            }
    # Support Clean (aka Search Engine Friendly) URLs</tt>
            location /demo/joomla/ {
                    try_files $uri $uri/ /demo/joomla/index.php?q=$request_uri;
            }
    
    when I add the following code to above Nginx Directives I get 404 Not Found

    Code:
    [COLOR="Red"]location /demo/concrete5 {
      root /demo/concrete5;
      index  index.html index.htm index.php;
      if (!-f $request_filename){
        set $rule_0 1$rule_0;
      }
      if (!-d $request_filename){
        set $rule_0 2$rule_0;
      }
      if ($rule_0 = "21"){
        rewrite ^/(.*)$ /index.php/$1 last;
      }
    
      location ~ \.php($|/) {
        try_files $uri =404;
        set  $script     $uri;
        set  $path_info  "";
        if ($uri ~ "^(.+\.php)(/.+)") {
          set  $script     $1;
          set  $path_info  $2;
        }
        fastcgi_pass unix:php5-fpm-sock;
        fastcgi_index  index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param  URI $uri;
        fastcgi_param  PATH_INFO        $path_info;
        fastcgi_param  SCRIPT_NAME      $script;
        fastcgi_param  SCRIPT_FILENAME  /demo/concrete/concrete5$script;
      }
    }[/COLOR]
     
    Last edited: Feb 2, 2013
  6. falko

    falko Super Moderator ISPConfig Developer

    The root line looks wrong. It must be the absolute path, not a relative one.
     
  7. onastvar

    onastvar Member

    This is my full NGINX Directives, I still get "Supports concrete5 request URLs" when trying to install Concrete5.

     
  8. falko

    falko Super Moderator ISPConfig Developer

    Try

    Code:
    location /demo/concrete5 {
    root /var/www/clients/client0/web2/web/demo/concrete5;
    index index.html index.htm index.php;
    if (!-f $request_filename){
    set $rule_0 1$rule_0;
    }
    if (!-d $request_filename){
    set $rule_0 2$rule_0;
    }
    if ($rule_0 = "21"){
    rewrite ^/(.*)$ [COLOR="Red"]/demo/concrete5[/COLOR]/index.php/$1 last;
    }
    
    location ~ \.php($|/) {
    try_files $uri =404;
    set $script $uri;
    set $path_info "";
    if ($uri ~ "^(.+\.php)(/.+)") {
    set $script $1;
    set $path_info $2;
    }
    fastcgi_pass unixhp5-fpm-sock;
    fastcgi_index index.php;
    include /etc/nginx/fastcgi_params;
    fastcgi_param URI $uri;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param SCRIPT_NAME $script;
    fastcgi_param SCRIPT_FILENAME [COLOR="Red"]$document_root[/COLOR]$script;
    }
    }
     
  9. onastvar

    onastvar Member

    Falko, thanks for taking a look. Unfortunately, that didn't work :( any other ideas?
     
  10. pvanthony

    pvanthony Member

    The above code works for me.

    Thank you for sharing this.

    P.V.Anthony
     

Share This Page