diff --git a/.htaccess b/.htaccess deleted file mode 100644 index abac24e..0000000 --- a/.htaccess +++ /dev/null @@ -1,26 +0,0 @@ -Options +FollowSymLinks -IndexIgnore */* -RewriteEngine on - -# Do not remove this line, otherwise mod_rewrite rules will stop working -RewriteBase / - -# if a directory or a file exists, use it directly -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$ - -# processes -RewriteRule ^api\/v1\/processes[\/]?$ v1/processes.php [END] -# process -RewriteRule ^api\/v1\/processes\/([0-9]+)[\/]?$ v1/process.php?id=$1 [END] -# tags -RewriteRule ^api\/v1\/processes\/([0-9]+)\/tags[\/]?$ v1/process_tags.php?id=$1 [END] -# timeline -RewriteRule ^api\/v1\/processes\/([0-9]+)\/timeline[\/]?$ v1/process_timeline.php?id=$1 [END] -# tags id -RewriteRule ^api\/v1\/tags\/([0-9]+)[\/]?$ v1/tag.php?id=$1 [END] -# records -RewriteRule ^api\/v1\/tags\/([0-9]+)\/records[\/]?$ v1/tag_records.php?id=$1 [END,QSA] -# test -RewriteRule ^(.*)$ v1/index.php?req=$1 [END] diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..3191e01 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: vendor/bin/heroku-php-nginx -C nginx_app.conf public/ diff --git a/nginx_app.conf b/nginx_app.conf new file mode 100644 index 0000000..a1797a6 --- /dev/null +++ b/nginx_app.conf @@ -0,0 +1,48 @@ +index index.php index.html; +charset UTF-8; +default_type text/html; + +gzip on; +gzip_disable "msie6"; + +gzip_vary on; +gzip_proxied any; +gzip_comp_level 6; +gzip_buffers 16 8k; +gzip_min_length 10; +gzip_http_version 1.1; +gzip_types application/json; + +client_max_body_size 10M; + +location / { + # try to serve file directly, fallback to rewrite + try_files $uri @rewriteapp; +} + +location @rewriteapp { + # rewrite all to app.php + rewrite ^(.*)$ /v1/index.php/?req=$1 last; +} + +location /api { + rewrite ^/api\/v1\/processes[\/]?$ /v1/processes.php; + rewrite ^/api\/v1\/processes\/([0-9]+)[\/]?$ /v1/process.php?id=$1; + rewrite ^/api\/v1\/processes\/([0-9]+)\/tags[\/]?$ /v1/process_tags.php?id=$1; + rewrite ^/api\/v1\/processes\/([0-9]+)\/timeline[\/]?$ /v1/process_timeline.php?id=$1; + rewrite ^/api\/v1\/tags\/([0-9]+)[\/]?$ /v1/tag.php?id=$1; + rewrite ^/api\/v1\/tags\/([0-9]+)\/records[\/]?$ /v1/tag_records.php?id=$1; +} + +location = /favicon.ico { + log_not_found off; + access_log off; +} + +location ~* \.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { + try_files $uri =404; + expires max; + add_header Pragma "public"; + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; + access_log off; +} diff --git a/v1/app/URI.php b/public/v1/app/URI.php similarity index 100% rename from v1/app/URI.php rename to public/v1/app/URI.php diff --git a/v1/index.php b/public/v1/index.php similarity index 100% rename from v1/index.php rename to public/v1/index.php diff --git a/v1/process.php b/public/v1/process.php similarity index 100% rename from v1/process.php rename to public/v1/process.php diff --git a/v1/process_tags.php b/public/v1/process_tags.php similarity index 100% rename from v1/process_tags.php rename to public/v1/process_tags.php diff --git a/v1/process_timeline.php b/public/v1/process_timeline.php similarity index 100% rename from v1/process_timeline.php rename to public/v1/process_timeline.php diff --git a/v1/processes.php b/public/v1/processes.php similarity index 100% rename from v1/processes.php rename to public/v1/processes.php diff --git a/v1/tag.php b/public/v1/tag.php similarity index 100% rename from v1/tag.php rename to public/v1/tag.php diff --git a/v1/tag_records.php b/public/v1/tag_records.php similarity index 100% rename from v1/tag_records.php rename to public/v1/tag_records.php