Skip to content

Instantly share code, notes, and snippets.

@ya-sasaki ya-sasaki/fuel.conf
Created Apr 13, 2015

Embed
What would you like to do?
Nginx, PHP-fpm, HHVM Configuration
server {
listen 80;
server_name localhost;
set $root_path '/var/www/fuel/public';
root $root_path;
index index.html index.htm index.php;
access_log /var/log/nginx/fuel_access.log;
error_log /var/log/nginx/fuel_error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri = 404;
include /etc/nginx/fastcgi_params;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
#fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATHINFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
error_page 404 /index.php;
#--------------------
# 静的ファイル設定
#--------------------
# 画像やCSSにはキャッシュの有効期限を設定&アクセスログOFF
location ~ \.(html|css|js|jpe?g|png|gif|svg|mpg|flv|swf)$ {
expires 10d;
access_log off;
break;
}
# .gitや.htaccessにはアクセス禁止
location ~ /\.(ht|git|svn) {
deny all;
}
# faviconへのアクセスは記録しない
location = /favicon.ico {
access_log off;
log_not_found off;
}
# robots.txtへのアクセスは記録しない
location = /robots.txt {
access_log off;
log_not_found off;
}
}
server {
listen 80;
server_name localhost;
set $root_path '/var/www/laravel/public';
root $root_path;
index index.html index.htm index.php;
access_log /var/log/nginx/laravel_access.log;
error_log /var/log/nginx/laravel_error.log;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri = 404;
include /etc/nginx/fastcgi_params;
#fastcgi_pass 127.0.0.1:9001;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
#fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATHINFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
error_page 404 /index.php;
#--------------------
# 静的ファイル設定
#--------------------
# 画像やCSSにはキャッシュの有効期限を設定&アクセスログOFF
location ~ \.(html|css|js|jpe?g|png|gif|svg|mpg|flv|swf)$ {
expires 10d;
access_log off;
break;
}
# .gitや.htaccessにはアクセス禁止
location ~ /\.(ht|git|svn) {
deny all;
}
# faviconへのアクセスは記録しない
location = /favicon.ico {
access_log off;
log_not_found off;
}
# robots.txtへのアクセスは記録しない
location = /robots.txt {
access_log off;
log_not_found off;
}
}
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
charset utf-8;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.1;
gzip_comp_level 1;
gzip_proxied any;
gzip_vary on;
gzip_buffers 4 8k;
gzip_min_length 1000;
gzip_types text/plain
text/xml
text/css
text/javascript
application/xml
application/xhtml+xml
application/rss+xml
application/atom_xml
application/javascript
application/x-javascript
application/x-httpd-php;
gzip_disable "MSIE [1-6]\.";
gzip_disable "Mozilla/4";
server_tokens off;
server_name_in_redirect off;
include /etc/nginx/conf.d/*.conf;
}
server {
listen 80;
server_name localhost;
set $root_path '/var/www/phalcon/public';
root $root_path;
index index.html index.htm index.php;
access_log /var/log/nginx/phalcon_access.log;
error_log /var/log/nginx/phalcon_error.log;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9001;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(._+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.(html|css|js|jpe?g|png|gif|svg|mpg|flv|swf)$ {
expires 10d;
access_log off;
break;
}
location ~ /\.(ht|git|svn) {
deny all;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
}
; common options
pid = /var/run/hhvm.pid
;hhvm.server.port = 9001
hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /tmp/.hhvm.hhbc
; php options
;; hhvm specific
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.