Pull to refresh
12
0
Send message
if'ы зло.
Рекомендуется использовать if только в случае если вы из него уходите (rewrite last, 30x redirect и т.п.). Это логично и это почти никогда не сломается в случае изменения логики в работе сервера.
Use try_files if it suits your needs. Use the «return ...» or «rewrite… last» in other cases. In some cases it's also possible to move ifs to server level (where it's safe as only other rewrite module directives are allowed within it).


Альтернативный вариант (на мой взгляд лучше читается):
server {
    listen 127.0.0.1:80;
    server_name nocache.domain.tld;
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf|txt|ico)$ {
        allow 127.0.0.1;
        deny all;
        root /path/to/fuse/filesystem;
    }
}

server {
    listen 80;
    server_name domain.tld
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf|txt|ico)$ {
        proxy_cache static_cache;
        proxy_cache_valid 200 1y;
        proxy_set_header Host nocache.$host;
        proxy_pass http://127.0.0.1;
    }
}
UFO landed and left these words here
Поясню, на всяк случай, что эта ересь:
function MyFoo() {
   var self = this;

   MyClass.apply(this, arguments);

   this.method1 = function () {}
   this.method2 = function () {}
}


Это просто глупость. Аналог на php:
class MyFoo {
   function __construct () {
      $self = $this;

      $this->method1 = function () use($self) { };
      $this->method2 = function () use($self) { };
   }
}


В js есть только один нормальный способ создавать «классы», вот он:
function MyFoo() {
}

MyFoo.prototype = {
   method1: function () {},
   method2: function () {}
};


Все нормальные обёртки просто инкапсулируют повторящиеся названия и громоздкое наследование.

Information

Rating
Does not participate
Location
Киев, Киевская обл., Украина
Registered
Activity