Re: Nginx ÎÅ ÏÔÒÁÂÁÔÙ×ÁÅÔ ÒÅ×ÒÁÊÔ
Alexander Kochetov
kochetov.alexander ÎÁ gmail.com
ðÔ äÅË 4 19:13:16 MSK 2009
á ËÕÄÁ ÏÎ ÄÏÌÖÅÎ ÌÅÚÔØ? õ ×ÁÓ root ÎÅ ÏÐÒÅÄÅÌÅÎ, ÎÉ × server, ÎÉ × location /my/
úÁ ÜÔÏ:
if (!-e $request_filename)
{
rewrite ^/$ /my/ permanent;
}
×ÁÓ ÓÅÊÞÁÓ ÎÁÞÎÕÔ ÚÄÅÓØ ÒÁÓÐÉÎÁÔØ.
--
Alexander Kochetov
4 ÄÅËÁÂÒÑ 2009 Ç. 18:27 ÐÏÌØÚÏ×ÁÔÅÌØ 100matolog <nginx-forum at nginx.us> ÎÁÐÉÓÁÌ:
> ÐÅÒÅÄÅÌÙ×ÁÀ ÉÚ ÁÐÁÞÅ×ÓËÏÇÏ ËÏÎÆÉÇÁ × nginx ( ÒÅ×ÒÁÊÔÏ× ÎÅÍÅÒÑÎÏ)
> ÈÏÞÕ ÓÄÅÌÁÔØ ËÒÁÓÉ×ÙÊ ÞÐÕ-ÛÎÙÊ ÁÄÒÅÓ. ÔÏÂÉÛØ šhttp://fpm.test.ru/my/
> ËÏÎÆÉÇ
>
> fpm# cat nginx.conf
> user šwww www;
> worker_processes 100;
> worker_priority -5;
> worker_rlimit_nofile 51200;
>
> events {
> š šworker_connections š51200;
> š šuse š š š š š š š š kqueue;
> }
>
> 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"';
>
> š šserver_names_hash_bucket_size š š š 512;
> š šsendfile š š š š š šon;
> š štcp_nopush š š š š šon;
> š škeepalive_timeout š 70 30;
> š šsend_timeout š š š š30s;
> š šreset_timedout_connection š on;
> š šresolver š š š š š š127.0.0.1;
> š šresolver_timeout š š10s;
>
> š šopen_file_cache š š š š š š max=100000 inactive=40s;
> š šopen_file_cache_valid š š š 60s;
> š šopen_file_cache_min_uses š š2;
> š šopen_file_cache_errors š š šon;
>
>
> ########################SERVER_LOCALHOST##############################
>
> š šserver {
> š š š šlisten š š š š š80;
> š š š šserver_name š š fpm.test.ru;
> š š š šclient_max_body_size 101M;
> š š š šlocation / {
> š š š š š šroot š š š š/usr/local/www/della/htdocs/;
> š š š š š šindex š š š index.html, index.php ;
> š š š š š šaccess_log /var/log/nginx/localhost-access.log š š šmain;
> š š š š š šerror_log /var/log/nginx/localhost-error.log š š š šerror;
>
> š š š š š š š š š }
>
> #####################################################################
> ################## š š šREWRITE š š š š š š š š #####################
>
> š šlocation /my/ š š š {
> š š š š š š š š š š š šif (!-e $request_filename)
> š š š š š š š š š š š š{
> š š š š š š š š š š š šrewrite ^/$ /my/ permanent;
> š š š š š š š š š š š š}
> š š š š š š š š š š š š}
>
> ################### š š š PHP-FPM š š š š š š š######################
>
>
> location ~* \.php$ {
> š š š š š šfastcgi_pass š š š š127.0.0.1:9000;
> š š š š š šfastcgi_index š š š index.php;
> š š š š š šfastcgi_param š š š SCRIPT_FILENAME š/usr/local/www/della/htdocs/$fastcgi_script_name;
> š š š š š šinclude š š š š š š fastcgi_params;
> š š š š}
>
>
> error_page š š š500 502 503 504 š š š š /50x.html;
> š š š šlocation = /50x.html {
> š š š š š šroot š š š š/usr/local/www/nginx-dist;
> š š š š}
> }
>
> }
>
>
> ÎÅ ÏÔÒÁÂÁÔÙ×ÁÅÔ - ÒÕÇÁÅÔÓÑ ÎÁ 404 Not Found
> × ÌÏÇÁÈ
>
> 2009/12/04 17:19:35 š45276#0: *7 "/usr/local/etc/nginx/html/my/index.html" is not found (2: No such file or directory), client: 10.100.101.14, server: fpm.test.ru, request: "GET /my/ HTTP/1.1", host: "fpm.test.ru", referrer: "http://fpm.test.ru/"
>
>
> ÚÁ ËÁËÉÍ ÂÏÌÔÏÍ ÏÎ ÌÅÚÅÔ × ÄÉÒÅËÔÏÒÉÀ "/usr/local/etc/nginx/html/my/....
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?21,27971,27971#msg-27971
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
ðÏÄÒÏÂÎÁÑ ÉÎÆÏÒÍÁÃÉÑ Ï ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ nginx-ru