Welcome! Log In Create A New Profile

Advanced

Re: как настроить простой rewrite

Александр Сытар
February 09, 2010 11:02AM
У меня работает на таких настройках:

## WWW main server
server {
listen ip:port;
server_name some_name;

access_log logs/www.access.log main;

root /usr/share/nginx/www;

location = / {
rewrite ^ /index.php/ last;
}

location = /index.php {
rewrite ^ /index.php/ last;
}

location / {
try_files $uri /index.php$uri;
}

location /index.php {
internal;
root /usr/share/nginx/www;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}

location ~* \.php$ {
root /usr/share/nginx/www;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}

### end

Ну и в ЦИ $config['uri_protocol'] = 'PATH_INFO';

9 февраля 2010 г. 18:24 пользователь smack87 <nginx-forum@nginx.us> написал:
> изменил nginx.conf так:
>
> worker_processes  1;
>
> events {
>  worker_connections  1024;
> }
>
>
> http {
>    include       mime.types;
>    default_type  application/octet-stream;
>
>    sendfile        on;
>    keepalive_timeout  65;
>
>
> server {
>          listen       80;
>
>          server_name  flashportal.com;
>          charset utf-8;
>
>          root c:/dev/www/flashportal;
>
>          rewrite (.*) /index.php?$1 last;
>
>          location / {
>          try_files $uri $uri/ @codeigniter;
>          }
>
>          location @codeigniter {
>          fastcgi_pass 127.0.0.1:9123;
>          fastcgi_param SCRIPT_FILENAME $document_root/index.php;
>          fastcgi_param QUERY_STRING $uri;
>          include fastcgi_params1;
>          }
>    }
> }
>
>
> fastcgi_params1, строку с QUERY удалил
>
>
> 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;
>
>
> перезапустил nginx, в логах ошибок нет:
>
> 2010/02/09 17:15:31  1484#924: signal process started
>
>
> Но работает все точно также. Я nginx.conf неправильно изменил? Может я что-то банальное спрашиваю, но мало что понимаю, так как новичек в этом деле
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?21,52637,52653#msg-52653
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

как настроить простой rewrite

smack87 February 09, 2010 09:32AM

Re: как настроить простой rewrite

Igor Sysoev February 09, 2010 09:50AM

Re: как настроить простой rewrite

smack87 February 09, 2010 10:24AM

Re: как настроить простой rewrite

Александр Сытар February 09, 2010 11:02AM

Re: как настроить простой rewrite

Igor Sysoev February 09, 2010 01:36PM

Re: как настроить простой rewrite

Igor Sysoev February 09, 2010 01:02PM

Re: как настроить простой rewrite

smack87 February 09, 2010 02:52PM

Re: как настроить простой rewrite

Igor Sysoev February 09, 2010 03:10PM

Re: как настроить простой rewrite

smack87 February 09, 2010 04:13PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 116
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready