This is a sample repository to get nginx + php fpm running on openshift.
More information about openshift: https://openshift.redhat.com/
If you are using openshift online you may want to take a look at the special nginx and php catridge
The .openshift/action_hooks
scripts:
- build:
- Build the versions of nginx, php and nodejs that are needed
- build_*
- The functions used for checking the versions and installing
- deploy
- This will render copy the nginx and php conf files
- Copy the .bash_profile if there is none
- common
- A common include script for the action hooks (just setting some path's)
- start
- Starts Nginx and php-fpm
- stop
- Stops Nginx and php-fpm
The .openshift/tmpl
templates:
Here are the templates used by the build and deploy scripts. Just customize away.
The web/
nginx web folder:
The web folder currently used. You can change this in .openshift/tmpl/nginx.conf.tmpl
.
To get PHP 5.6 working at OpenShift, you have to do the following:
- Create a new Openshift "Do-It-Yourself" application
- Clone this repository
- Add a new remote "openshift" (You can find the URL to your git repository on the Openshift application page)
- Run
git push --force "openshift" master:master
- SSH into your gear
- Wait for build to finish (This may take at least an hour)
- Open http://appname-namespace.rhcloud.com/ to verify
Support for NodeJS is availible!
Just uncomment NODE_VERSION
in .openshift/action_hooks/build
and commit/push the file.
Support for Phalcon is availible!
Just uncomment PHALCON_VERSION
in .openshift/action_hooks/build
and commit/push the file.
To get PHP 5.4 to build open .openshift/action_hooks/build_php
and remove --enable-opcache
(line: 68).
Currently the .openshift/tmpl/nginx.conf.tmpl
configuration template for nginx only redirects to the web/index.php
file.
You can change this by editing the template file. Also see http://wiki.nginx.org/Symfony for some extra information.
This probably happens because they are not executable.
Just do git update-index --chmod=+x -- $(git ls-files .openshift/action_hooks/*)
in your project root and commit/push.
This seems to be a problem within openshift (see https://www.openshift.com/forums/openshift/openshift-build-timeout).
To resume the build, first make an arbitary change to your local repo (e.g. add some text to README.md), commit that change and then do another git push --force "openshift" master:master
.
Maybe have a look at stackoverflow and if you end up empty-handed just create a issue.
Thanks to the following people:
Some articles that mention how you can use this repo and other related articles:
- [DIY] Nginx + PHP 5.4 origional forum post.
- Nginx, PHP5.5 and Phalcon on OpenShift by Bruno Skvorc using a fork by duythien.
- How to Run Nginx PHP-FPM under OpenShift a cartridge created by Getup Cloud
If you wrote a article about openshit and nginx+php please let me know so I can add it to the list.