codeigniter - Nginx: Serve Files from different Root Locations -


hej,

i have following situation: have 2 systems running (magento , codeigniter) should operate under same url. magento responsible few urls:

http://dev/checkout, http://dev/kasse example should served magento lies in /vagrant/magento

all other request should served codeigniter lies in /vagrant/codeigniter

i got working, uses if's , have add folder in 2 files, not nice. , php thinks root lies in wrong folder (/vagrant/, without magento folder)

what doing wrong , how right?

thanks!

# ./sites-available/default  server {         listen 80;         listen [::]:80 default_server ipv6only=on;          server_name rh.dev;          root /vagrant/codeigniter/;          location ~ /(kasse|tools|checkout|warenkorb|skin|media) {                 alias /vagrant/magento/;                 index index.php;                  try_files $uri $uri/ @handler;         }          location / {                 index index.php;                  if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") {                         access_log off;                         expires max;                 }                  try_files $uri $uri/ @handler;         }          location @handler {                 rewrite / /index.php;         }          location ~.php/ {                 rewrite ^(.*.php)/ $1 last;         }          include /etc/nginx/php.conf; }  # ./php.conf  fastcgi_intercept_errors on;  location ~ \.php$ {     fastcgi_split_path_info ^(.+\.php)(/.+)$;      set $php_root /vagrant/codeigniter/;      if ( $request_uri ~ /(kasse|tools|checkout|warenkorb|skin|media) ) {         set $php_root /vagrant/magento/;     }      include fastcgi_params;      fastcgi_index index.php;     fastcgi_pass unix:/var/run/php5-fpm.sock; }  # ./fastcgi_params  fastcgi_param   query_string        $query_string; fastcgi_param   request_method      $request_method; fastcgi_param   content_type        $content_type; fastcgi_param   content_length      $content_length;  #fastcgi_param  script_filename     $request_filename; fastcgi_param   script_filename         $php_root$fastcgi_script_name; fastcgi_param   script_name     $fastcgi_script_name; fastcgi_param   request_uri     $request_uri; fastcgi_param   document_uri        $document_uri; fastcgi_param   document_root       $document_root; fastcgi_param   server_protocol     $server_protocol;  fastcgi_param   gateway_interface   cgi/1.1; fastcgi_param   server_software     nginx/$nginx_version;  fastcgi_param   remote_addr     $remote_addr; fastcgi_param   remote_port     $remote_port; fastcgi_param   server_addr     $server_addr; fastcgi_param   server_port     $server_port; fastcgi_param   server_name     $server_name;  fastcgi_param   https           $https;  # php only, required if php built --enable-force-cgi-redirect fastcgi_param   redirect_status     200; 

first of advice take backup of conf file before starting this.

anyway, doing great @ first, added stuff didn't need added, example

try_files $uri $uri/ @handler; 

this line doesn't need split two, merge rewrite it

try_files $uri $uri/ /index.php; 

but makes me wonder how it's working without $request_uri, if doesn't work try using line instead:

try_files $uri $uri/ /index.php$request_uri; 


block don't understand it's supposed do

location ~.php/ {     rewrite ^(.*.php)/ $1 last; } 

i'd it's safe remove entirely, cause seems rewriting request same thing was.


, inside php conf, whole if thing not necessary, it's understood path , location blocks of file

set $php_root /vagrant/codeigniter/;  if ( $request_uri ~ /(kasse|tools|checkout|warenkorb|skin|media) ) {     set $php_root /vagrant/magento/; } 

i'd try remove , it's supposed still working


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -