Problem using Magento with nginx

Stefan Scott lists at ruby-forum.com
Fri Feb 6 21:09:02 MSK 2009


Hello -

I have installed nginx + PHP-FPM and it is working perfectly for my
Drupal sites (nginx 0.6.33, PHP 5.2.6, FPM 0.5.9, Drupal 6.6, Debian
Etch).

Now I am trying to use Magento (1.2.1) with nginx, and I am getting the
error message "No input file specified."


I have adapted the instructions for installing Magento on Debian Etch
here:

http://www.howtoforge.com/magento-e-commerce-solution-debian-etch

(omitting the steps involving Apache).



I have adapted the the nginx.conf files for Magento posted here:

http://www.magentocommerce.com/boards/viewthread.../viewthread/7931/#t29161
http://www.ruby-forum.com/topic/130700



My nginx.conf file looks like this:

user  www-data www-data;
worker_processes  2;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local]
$request '
    #                  '"$status" $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip on;
    gzip_comp_level 1; gzip_proxied any;
    gzip_types text/plain
               text/html
               text/css
               application/x-javascript
               text/xml
               application/xml
               application/xml+rss
               text/javascript;

     ## Deny access to any host other than (www.)mydomain.com
    server {
         server_name  _;  #default
         return 444;
     }

# ...

  server {
    listen   80;
    server_name  .mysubdom.mydom.net;

    access_log  /usr/local/nginx/logs/mysubdom.access.log;
    error_log   /usr/local/nginx/logs/mysubdom.error.log;

    gzip on;
    #gzip_comp_level 9;
    gzip_min_length  1000;
    gzip_proxied any;
    gzip_types       text/plain application/xml text/html text/css
text/js application/x-javascript;

    #error_page  404  /404.html;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   html;
    }

    # media
    location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|swf)$ {
      root /home/stefan/sources/magento/;
      access_log        off;
      expires           30d;
      break;
    }


    # pass the PHP scripts to FastCGI socket
    location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param  SCRIPT_NAME $fastcgi_script_name;
      fastcgi_param  SCRIPT_FILENAME
/home/stefan/sources/magento$fastcgi_script_name;
      include /usr/local/nginx/conf/fastcgi_params;
    }
    location ^~ /js/proxy.php {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param  SCRIPT_NAME $fastcgi_script_name;
      fastcgi_param  SCRIPT_FILENAME
/home/stefan/sources/magento$fastcgi_script_name;
      include /usr/local/nginx/conf/fastcgi_params;
      access_log off;
      expires 30d;
    }
    location / {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param  SCRIPT_NAME index.php;
      fastcgi_param  SCRIPT_FILENAME
/home/stefan/sources/magento/index.php;
      include /usr/local/nginx/conf/fastcgi_params;
    }
  }

# ...

}



My file /usr/local/nginx/conf/fastcgi_params looks like this:

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

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;



My Magento installation looks like this:

ls -l /home/stefan/sources/magento

total 112
drwxrwxr-x  3 root root      4096 2009-02-02 19:11 404
drwxrwxr-x  6 root root      4096 2009-02-02 19:11 app
-rw-rw-r--  1 root root      1579 2009-02-02 14:16 cron.php
drwxrwxr-x  7 root root      4096 2009-02-02 19:11 downloader
-rw-rw-r--  1 root root      1150 2009-02-02 14:16 favicon.ico
-rw-rw-r--  1 root root      1892 2009-02-02 14:16 index.php
-rw-rw-r--  1 root root      1901 2009-02-02 14:16 index.php.sample
-rw-rw-r--  1 root root      6129 2009-02-02 14:16 install.php
drwxrwxr-x 10 root root      4096 2009-02-02 19:11 js
drwxrwxr-x  7 root root      4096 2009-02-02 19:11 lib
-rw-rw-r--  1 root root     10421 2009-02-02 14:16 LICENSE_AFL.txt
-rw-rw-r--  1 root root     10410 2009-02-02 14:16 LICENSE.txt
drwxrwxr-x  4 root www-data  4096 2009-02-02 19:11 media
-rwxrwxr-x  1 root root      2982 2009-02-02 14:16 pear
-rw-rw-r--  1 root root       751 2009-02-02 14:16 php.ini.sample
drwxrwxr-x  2 root root      4096 2009-02-02 19:11 pkginfo
drwxrwxr-x  3 root root      4096 2009-02-02 19:11 report
drwxrwxr-x  5 root root      4096 2009-02-02 19:11 skin
-rw-rw-r--  1 root root     14597 2009-02-02 14:16 STATUS.txt
drwxrwxr-x  2 root www-data  4096 2009-02-02 19:11 var



When I point my browser at http://mysubdom.dom.net, I get the message:

No input file specified.



Do you have any ideas what I am doing wrong here?

Thank you for any help.

- Stefan Scott Alexander
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list