HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   concrete5 and Nginx (http://www.howtoforge.com/forums/showthread.php?t=60067)

calidan 30th December 2012 08:22

concrete5 and Nginx
 
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;
}

falko 31st December 2012 14:05

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;
  }
}


onastvar 31st January 2013 16:50

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

falko 1st February 2013 17:22

Can you post the vhost configuration you're currently using?

onastvar 2nd February 2013 01:03

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:

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;
  }
}


falko 2nd February 2013 12:13

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

onastvar 2nd February 2013 22:31

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

Quote:

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 ^/(.*)$ /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;
}
}

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;
}

location /webmail/

if ($http_host != "www.mydomain.com") {
rewrite ^ http://mydomain.com/webmail$request_uri permanent;
}

index index.php index.html;

location ~ ^/favicon.ico$ {
root /var/www/clients/client0/web2/web/webmail/skins/default/images;
log_not_found off;
access_log off;
expires max;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/(bin|SQL)/ {
deny all;
}

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
}

falko 4th February 2013 13:01

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 ^/(.*)$ /demo/concrete5/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 $document_root$script;
}
}


onastvar 4th February 2013 19:41

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

pvanthony 3rd July 2013 03:25

Quote:

Originally Posted by falko (Post 291547)
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 ^/(.*)$ /demo/concrete5/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 $document_root$script;
}
}


The above code works for me.

Thank you for sharing this.

P.V.Anthony


All times are GMT +2. The time now is 00:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.