Forum: NGINX got it!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8072fdc83f765ae5075f252cb4d4d111?d=identicon&s=25 Chris Cortese (Guest)
on 2009-03-01 14:30
(Received via mailing list)
ok, sorry I've sent so many messages on this topic but just now I got
everything going, the javascript, the php-ajax-perl photo upload... that
should be everything.

Here is my config.  This might be useful to other CodeIgniter (or
similar PHP MVC frameworks) users out there.

server {
  listen   81;
  server_name  dev.my_domain.com;

  access_log  /var/log/nginx/dev_my_domain.access.log;
  error_log /var/log/nginx/dev_my_domain.error.log;

  root /home/my_linux_user/www/dev/my_domain/trunk/html/public;

  location / {
    rewrite ^(.*)$ /index.php?q=$1;
    index index.php;
    error_page 404 /index.php?q=$1;
  }

  location /style/ {
    rewrite ^/style/(.*)$ /combine.php?type=css&files=$1 last;
  }

  location /javascript/ {
    rewrite ^/javascript/(.*)$ /combine.php?type=javascript&files=$1
last;
  }

  location /tmp/ {
  }

  location /filestore/ {
  }

  location /images/ {
  }

  location /cgi-bin/ {
    root /home/my_linux_user/www/dev/my_domain/trunk;
    fastcgi_pass unix:/tmp/cgi.sock;
    include /etc/nginx/perl_fcgiwrap_params;
  }

  location ~* (jpg|jpeg|gif|png|js|css) {
      expires    30d;
      access_log off;
  }

  location ~ \.php$ {
    fastcgi_pass  127.0.0.1:10005;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME
/home/my_linux_user/www/dev/my_domain/trunk/html/public$fastcgi_script_name;
#    fastcgi_param SCRIPT_FILENAME
/home/my_linux_user/www/dev/my_domain/trunk/html/public/index.php;
    include /etc/nginx/fastcgi_params;
  }

  location = /style/main_style.php {
    fastcgi_pass  127.0.0.1:10005;
    fastcgi_param SCRIPT_FILENAME
/home/my_linux_user/www/dev/my_domain/trunk/html/public/style/main_style.php;
    include /etc/nginx/fastcgi_params;
  }
}
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-03-01 17:13
(Received via mailing list)
On Sun, Mar 01, 2009 at 05:22:17AM -0800, Chris Cortese wrote:

> ok, sorry I've sent so many messages on this topic but just now I got
> everything going, the javascript, the php-ajax-perl photo upload... that
> should be everything.
>
> Here is my config.  This might be useful to other CodeIgniter (or
> similar PHP MVC frameworks) users out there.

It can not be usefull due to this mess:

  location / {
    rewrite ^(.*)$ /index.php?q=$1;
    index index.php;
    error_page 404 /index.php?q=$1;
  }

Only
    rewrite ^(.*)$ /index.php?q=$1;
works here.

If it is so, then better to just set fastcgi handler instead of
rewrites (forget about RewriteRule's in .htaccess, think different):

  location / {
    fastcgi_pass  127.0.0.1:10005;

    fastcgi_param SCRIPT_FILENAME
        /home/my_linux_user/www/dev/my_domain/trunk/html/public/index.php;

    fastcgi_param QUERY_STRING      q=$request_uri;

    # you need to exclude QUERY_STRING from fastcgi_params
    include /etc/nginx/fastcgi_params;
  }

The same is for
  location /style/ {
and
  location /javascript/ {
This topic is locked and can not be replied to.