T
T
Timur2013-11-06 11:25:40
Nginx
Timur, 2013-11-06 11:25:40

Help translate apache config to nginx for PHPRedMin

I can't fully understand nginx. There is a PHP client for Redis ,
And here is the config for Apache

# phpredmin - Simple web interface to manage and monitor your Redis
# 
# Allows only localhost by default

Alias /phpredmin /var/www/phpredmin/public

<Directory /var/www/phpredmin/>
   AllowOverride All 

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip localhost
       Require local
     </RequireAny>
   </IfModule>

   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>


I don't need IP restrictions, I'm currently working on a virtual machine. But with the launch of the trouble. Uploaded the application to /var/www/redis/
You need to run /var/www/redis/public/index.php

I wrote the following config for nginx
server {
    listen 80;
    set $bootstrap "index.php";
    server_name redis.dev;
    root  /var/www/redis/public;
    index $bootstrap;
    
    
    
    location ~ \.php$ {
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      # позволяем перехватывать запросы к несуществующим PHP-файлам
      set $fsn /$bootstrap;
      if (-f $document_root$fastcgi_script_name){
        set $fsn $fastcgi_script_name;
      }
      # With php5-fpm:
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      include fastcgi_params;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;

      # PATH_INFO и PATH_TRANSLATED могут быть опущены, но стандарт RFC 3875 определяет для CGI
      fastcgi_param  PATH_INFO        $fastcgi_path_info;
      fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
    }
  }

But I can only open the main page. Attempts to go to any link (for example, redis.dev/index.php/welcome/index/1 ) return 404 Not Found. in the logs
2013/11/06 12:18:20 [error] 5728#0: *8 open() "/var/www/redis/public/index.php/welcome/index/1" failed (20: Not a directory) , client: 192.168.237.1, server: redis.dev, request: "GET /index.php/welcome/index/1 HTTP/1.1", host: "redis.dev", referrer: " redis.dev/ "


help me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur, 2013-11-06
@XAKEPEHOK

He asked, he answered. added to config

location ~ \.(js|css|png|jpg|gif|bmp|swf|ico|pdf|mov|fla|mp4|3gp|zip|rar|7z)$ {
  try_files $uri = 404;
  access_log off;
  expires 24h;
}
    
location / {
  rewrite .* /index.php;
  index  index.html $bootstrap;
  try_files $uri $uri/ /$bootstrap?$args;
}

Everything is working.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question