Skip to content

Instantly share code, notes, and snippets.

@boekkooi
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save boekkooi/ae9f09c107510f50a0cf to your computer and use it in GitHub Desktop.
Save boekkooi/ae9f09c107510f50a0cf to your computer and use it in GitHub Desktop.
Openshift + Phalcon

Create your openshift application (https://github.com/boekkooi/openshift-cartridge-nginx, https://github.com/boekkooi/openshift-cartridge-php):

rhc create-app myapp http://cartreflect-claytondev.rhcloud.com/github/boekkooi/openshift-cartridge-nginx
rhc cartridge add -a myapp http://cartreflect-claytondev.rhcloud.com/reflect?github=boekkooi/openshift-cartridge-php

Now checkout the repo. Modify .openshift/nginx.conf.erb to look like this gists 1_nginx.conf.erb and add .openshift/action_hooks/build with the content of this gists 2_build (make sure to do chmod +x) also add .openshift/php-pecl.txt. with the content of 3_php-pecl.txt

Commit and push and you'r done.

## .openshift/nginx.conf.erb
# Enable Gzip
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/json
application/xml
application/rss+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
server {
listen <%= ENV['OPENSHIFT_NGINX_IP'] %>:<%= ENV['OPENSHIFT_NGINX_PORT'] %>;
root <%= ENV['OPENSHIFT_REPO_DIR'] %>/public;
location / {
try_files $uri @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass unix:<%= ENV['OPENSHIFT_PHP_SOCKET'] %>;
fastcgi_index /index.php;
include <%= ENV['OPENSHIFT_NGINX_DIR'] %>/usr/nginx-<%= ENV['OPENSHIFT_NGINX_VERSION'] %>/conf/fastcgi_params;
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;
fastcgi_param HTTPS off;
}
location ~ /\.ht {
deny all;
}
}
## .openshift/action_hooks/build
#!/bin/bash
set -e
# Build PHP extra's
# Update conf/ini filesand install pecl extensions
${OPENSHIFT_PHP_DIR}/bin/control build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment