непонятка с rewrite
RaPaMaN
rapaman at virthost.net
Sat Apr 9 18:47:02 MSD 2005
я только что пересобрал 0.1.28 с дебаг, обновил 0.1.27 на котором все
грабли были и работает теперь нормально, т.е. нет 404
от 0.1.28 слать дебаг или сделать все-таки на 0.1.27 дебаг лог ?
Igor Sysoev пишет:
> On Sat, 9 Apr 2005, RaPaMaN wrote:
>
>> логе :
>>
>> 2005/04/09 09:30:03 [notice] 28751#0: *73023 "^.+$" matches
>> "/en/super/stats/", client: xxx.xxx.xxx.xxx, server: domain.net, URL:
>> "/en/super/stats/", host: "domain.net", referrer: "http://domain.net/"
>>
>> 2005/04/09 09:30:03 [notice] 28751#0: *73023 rewritten data:
>> "/index.php", args: "", client: xxx.xxx.xxx..xxx, server: domain.net,
>> URL: "/en/super/stats/", host: "domain.net", referrer:
>> "http://domain.net/"
>>
>> а на экран - 404
>
>
> А зачем "location ~ ^.+$" ? Для этого достаточно "location /"
> Какой rewrite стоит для этого locaiton ?
> Правильно ли отрабатывает запрос "/index.php" ?
А это уже nginx 0.1.27 берет откуда-то из следующей конфигурации, а
0.1.28 работает нормально:
server {
listen xxxx.xxxx.xxxx.xxx:80;
server_name www.domain.net domain.net;
access_log /var/www/domain.net/logs/nginx_access.log;
error_log /var/www/domain.net/logs/nginx_error.log debug;
location = / {
root /var/www/domain.net/html;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/usr/local/fastcgi/fcgi;
fastcgi_root /var/www/domain.net/html;
fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_header_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
## fastcgi_temp_path /var/tmp;
## fastcgi_next_upstream error timeout invalid_header http_500
http_404;
## fastcgi_next_upstream error timeout;
fastcgi_x_powered_by off; # default on
fastcgi_params remote_addr
server_name
server_addr # one more syscall for request
server_port
script_name
script_filename
remote_port
server_protocol
server_software
gateway_interface
request_uri
document_root
redirect_status; # if php with --enable-cgi-redirect
}
location = /index.php {
root /var/www/domain.net/html;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/usr/local/fastcgi/fcgi;
fastcgi_root /var/www/domain.net/html;
# fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_header_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
## fastcgi_temp_path /var/tmp;
## fastcgi_next_upstream error timeout invalid_header http_500
http_404;
## fastcgi_next_upstream error timeout;
fastcgi_x_powered_by off; # default on
fastcgi_params remote_addr
server_name
server_addr # one more syscall for request
server_port
script_name
script_filename
remote_port
server_protocol
server_software
gateway_interface
request_uri
document_root
redirect_status; # if php with --enable-cgi-redirect
}
location ~* \.(php)$ {
root /var/www/domain.net/html;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/usr/local/fastcgi/fcgi;
fastcgi_root /var/www/domain.net/html;
# fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_header_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
## fastcgi_temp_path /var/tmp;
## fastcgi_next_upstream error timeout invalid_header http_500
http_404;
## fastcgi_next_upstream error timeout;
fastcgi_x_powered_by off; # default on
fastcgi_params remote_addr
server_name
server_addr # one more syscall for request
server_port
script_name
script_filename
remote_port
server_protocol
server_software
gateway_interface
request_uri
document_root
redirect_status; # if php with --enable-cgi-redirect
}
location ~* \.(jpg|jpeg|gif|png|css|ico|html|txt)$ {
root /var/www/domain.net/html;
expires 1d;
}
location ~* (\.htaccess|\.htpasswd|htpasswd|htaccess|\.inc)$ {
return 403;
}
location / {
rewrite ^.+$ /index.php;
}
}
More information about the nginx-ru
mailing list