Ярлыки

Memories ( 25 ) Unix ( 14 ) FreeBSD ( 8 ) www ( 4 ) Scripts ( 3 ) GEOM ( 2 ) PART ( 2 ) smtp ( 2 ) Cacti ( 1 ) Jabber ( 1 ) KVM ( 1 ) Kohana ( 1 ) RAID ( 1 ) Sip ( 1 ) Ubuntu ( 1 ) Zyxel ( 1 ) nginx ( 1 ) php-fpm ( 1 ) portwfd ( 1 ) rewrite ( 1 ) security ( 1 )

Поиск по этому блогу

четверг, 27 октября 2011 г.

Kohana & phpmyadmin with Nginx+php-fpm – VirtualHost configuration & rewrite

Полдня составлял конфиг. Все таки информации именно по этой теме не так уж и много.


#
# HTTPS server
#
server {
    listen   443;
    server_name  .example.com;
    root   /data/www;
    index  index.html index.htm index.php;
    access_log  /var/log/nginx/ssl.access.log;
    error_log  /var/log/nginx/ssl.error.log;
    ssl  on;
    ssl_certificate  /etc/nginx/ssl.crt/localhost.crt;
    ssl_certificate_key  /etc/nginx/ssl.key/localhost.key;
    ssl_session_timeout  5m;
    ssl_protocols  SSLv3 TLSv1;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers   on;
    auth_basic            "Enter Password:";
    auth_basic_user_file  /etc/nginx/htpasswd;
    location /phpmyadmin {
        root /usr/share;
        index index.php;
#        auth_basic            "Enter Password:";
#        auth_basic_user_file  /etc/nginx/htpasswd;
    }
    location ~ ^/phpmyadmin.+\.php$ {
        root /usr/share;
        fastcgi_pass   unix:/var/run/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_param HTTPS on;
#        auth_basic            "Enter Password:";
#        auth_basic_user_file  /etc/nginx/htpasswd;
    }
    location /phpMyAdmin {
        rewrite ^/* /phpmyadmin last;
    }
    # ROUTING TO KOHANA IF REQUIRED
    location / {
#        auth_basic            "Enter Password:";
#        auth_basic_user_file  /etc/nginx/htpasswd;
        try_files $uri $uri/ @kohana;
    }
    # BLOCKS ACCESS TO . FILES (.svn, .htaccess, ...)
    location ~ /\. {
        deny  all;
    }
    # Protect application and system files from being viewed
    location ~* ^/(?:application|modules|system)\b.* {
        rewrite ^(.+)$ /index.php$1 permanent;
    }
    # FOR PHP FILES
    location ~* \.php$ {
        # PHP FILES MIGHT BE TO HANDLED BY KOHANA
        try_files $uri $uri/ @kohana;

        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    # HANDLES THE REWRITTEN URLS TO KOHANA CONTROLLER
    location @kohana
    {
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    }
}

Комментариев нет :

Отправить комментарий