A basic template for getting Nginx running on Travis CI's container based infrastructure.
Do you need to run some automated tests that rely on Nginx on Travis CI? Do you want those tests to run on the Docker container-based infrastructure? Are you pulling your hair out trying to get this all to work? Then this repo is for you.
Travis CI does not come with Nginx pre-installed so the install needs to be scripted. Since Travis CI's container-based infrastructure doesn't allow sudo privileges this installation is non-trivial. Hopefully, by providing this repo I can save someone some hassle trying to get Nginx set up for their project.
All of the installation files are located in the /travis directory. The main installation is done through the install-nginx.sh bash script. It's a short script so it should be relatively easy to follow. The other scripts are basic Nginx and php-fpm configuration templates. The basic install process goes as follows:
- Install Nginx using the apt addon via entries in the .travis.yml file.
- Collect some useful information for the install into environment variables.
- Copy the configuration templates to a new directory while replacing placeholders with environment variables.
- Start php-fpm and Nginx with our custom configuration file instead of the default.
There is also a quick curl to the web server to ensure that everything works correctly.
Unfortunately, the hhvm install does not work. Part of the problem is I think hhvm requires sudo case closed. That being said I did a fair amount of experimenting with the sudo VM and couldn't get hhvm to work there either. I'm hoping some kind expert can offer some advice in the near future.