nginx:yii2

Yii2

server {

                listen 8082;
                server_name [[DOMAIN]] www.[[DOMAIN]];
                root /usr/local/var/www/[[DOMAIN]]/httpdocs/app/web;
                index index.php;

                access_log /usr/local/var/log/nginx/[[DOMAIN]].access.log;
                error_log  /usr/local/var/log/nginx/[[DOMAIN]].error.log error;

                charset utf-8;
                #charset        windows-1251;

                location = /favicon.ico {
                        log_not_found off;
                        access_log off;
                        break;
                }

                location = /robots.txt {
                        allow all;
                        log_not_found off;
                        access_log off;

                        index index.php;
                        try_files $uri $uri/ /index.php?$query_string;
                }


                location / {

                        #auth_basic            "Website development";
                        #auth_basic_user_file  /usr/local/var/www/vse2.loc/vse2/authfile;

                        index index.php;
                        try_files $uri $uri/ /index.php?$query_string;
                }

                location ~ \.(png|jpg|jpeg|gif|swf|ico|mov|fla|pdf|ttf|woff|eot)$ {
                        expires 30d;
                        log_not_found off;
                        access_log off;
                        add_header X-media-header media-header-content;
                        break;
                }

                location ~ \.(js|css|zip|rar|pdf)$ {
                        expires 1w;
                        log_not_found off;
                        access_log off;
                        #try_files  =404;
                        #try_files $uri $uri/ /index.php?$query_string;
                }

                location ~ /(protected|themes/\w+/views)/ {
                        access_log off;
                        log_not_found off;
                        return 404;
                }

                # Подключаем обработчик
                location ~ \.php {
                        #try_files  =404;
                        include fastcgi_params;
                        include php-fpm;
                }

                # Прячем все системные файлы
                location  ~ /\. {
                        deny  all;
                        access_log off;
                        log_not_found off;
                }

}
  • nginx/yii2.txt
  • Последнее изменение: 2016/02/02 03:43
  • (внешнее изменение)