Skip to content

Instantly share code, notes, and snippets.

@soardex
Created May 22, 2014 01:10
Show Gist options
  • Save soardex/917cc40485315dd78c33 to your computer and use it in GitHub Desktop.
Save soardex/917cc40485315dd78c33 to your computer and use it in GitHub Desktop.
Kohana on nginx vhost.
#user nobody;
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
fastcgi_temp_path temp/fastcgi;
uwsgi_temp_path temp/uwsgi;
scgi_temp_path temp/scgi;
client_body_temp_path temp/client-body 1 2;
proxy_temp_path temp/proxy;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
# Size Limits
client_body_buffer_size 64k;
client_header_buffer_size 4k;
client_max_body_size 8M;
# Timeouts
client_body_timeout 60;
client_header_timeout 20;
keepalive_timeout 60;
send_timeout 60;
# FastCGI
fastcgi_connect_timeout 60;
fastcgi_send_timeout 120;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
# output compression saves bandwidth
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
gzip_buffers 16 8k;
gzip_comp_level 5;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# show all files and folders
autoindex off;
server {
listen 127.0.0.1:80;
server_name localhost;
root www;
charset utf-8;
access_log logs/access.log main;
location / {
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root www;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9100;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+.(gif|ico|jpg|jpeg|png|flv|swf|pdf|mp3|mp4|xml|txt|js|css)$ {
expires 30d;
}
location ~ /(\.ht|\.git|\.svn) {
deny all;
}
}
# kohana on vhost port 8080
server {
listen 127.0.0.1:8080;
server_name localhost;
root www/kohana;
charset utf-8;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9100;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/(modules|application|system) {
deny all;
}
location ~ /(\.ht|\.git|\.svn) {
deny all;
}
}
include domains-enabled/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment