PHPackages                             typisttech/travis-nginx-wordpress - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. typisttech/travis-nginx-wordpress

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

typisttech/travis-nginx-wordpress
=================================

A basic template for Nginx and WordPress running on Travis CI's container based infrastructure.

3.0.0(8y ago)778.1kMITShell

Since Feb 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/typisttech/travis-nginx-wordpress)[ Packagist](https://packagist.org/packages/typisttech/travis-nginx-wordpress)[ Docs](https://www.typist.tech/projects/travis-nginx-wordpress)[ RSS](/packages/typisttech-travis-nginx-wordpress/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Travis CI Nginx WordPress Test
==============================

[](#travis-ci-nginx-wordpress-test)

[![Latest Stable Version](https://camo.githubusercontent.com/5c5ef80f1cfc809efcb4f8472bc3e7eadb39e1f74af06074dcfe37ae734b6c21/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f7472617669732d6e67696e782d776f726470726573732f762f737461626c65)](https://packagist.org/packages/typisttech/travis-nginx-wordpress)[![Total Downloads](https://camo.githubusercontent.com/ded34fcfe4f6dd3326d195730992ced7321f0b8d1a8e16ba4767fbc9066e4804/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f7472617669732d6e67696e782d776f726470726573732f646f776e6c6f616473)](https://packagist.org/packages/typisttech/travis-nginx-wordpress)[![Build Status](https://camo.githubusercontent.com/d4e84f10931d7dabcf4c01dc254743e80ed3ab5194cbc5cdce3d2e266de9383b/68747470733a2f2f7472617669732d63692e6f72672f547970697374546563682f7472617669732d6e67696e782d776f726470726573732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TypistTech/travis-nginx-wordpress)[![PHP Versions Tested](https://camo.githubusercontent.com/48c9b7542d9e47b77b57f135674e4b1101356292d14b5d2656ca21841247c6fd/687474703a2f2f7068702d6579652e636f6d2f62616467652f747970697374746563682f7472617669732d6e67696e782d776f726470726573732f7465737465642e737667)](https://travis-ci.org/TypistTech/travis-nginx-wordpress)[![License](https://camo.githubusercontent.com/e81aff21cca6e3fb41057b9dcffe688798444e30f491ce653f664fed510c4590/68747470733a2f2f706f7365722e707567782e6f72672f747970697374746563682f7472617669732d6e67696e782d776f726470726573732f6c6963656e7365)](https://packagist.org/packages/typisttech/travis-nginx-wordpress)[![Hire Typist Tech](https://camo.githubusercontent.com/e392a964bbdc0c32d95825bbc8253027387bcb9b021176d807d22ac75d86f308/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f486972652d547970697374253230546563682d6666363962342e737667)](https://typist.tech/contact/)

A basic template for Nginx and WordPress running on Travis CI's container based infrastructure.

- [What is the purpose of this repo?](#what-is-the-purpose-of-this-repo)
- [Installation and Usage](#installation-and-usage)
- [Customization](#customization)
- [How does it works?](#how-does-it-works)
    - [WordPress](#wordpress)
    - [Nginx](#nginx)
    - [Codeception](#codeception)
    - [Codecov.io](#codecovio)
    - [Scrutinizer CI](#scrutinizer-ci)
- [Known Issues](#known-issues)
- [See Also](#see-also)
- [Real life examples that use this package](#real-life-examples-that-use-this-package)
- [Support!](#support)
    - [Donate via PayPal \*](#donate-via-paypal-)
    - [Why don't you hire me?](#why-dont-you-hire-me)
    - [Want to help in other way? Want to be a sponsor?](#want-to-help-in-other-way-want-to-be-a-sponsor)
- [Change Log](#change-log)
- [Credit](#credit)
- [License](#license)

What is the purpose of this repo?
---------------------------------

[](#what-is-the-purpose-of-this-repo)

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](http://blog.travis-ci.com/2014-12-17-faster-builds-with-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.

Installation and Usage
----------------------

[](#installation-and-usage)

The script is tailored on Travis CI PHP build images and might not work in every situation. Below is an basic example of `.travis.yml`:

```

# .travis.yml
language: php

services:
  - mysql

cache:
  apt: true
  directories:
    - $HOME/.composer/cache/files

addons:
  apt:
    packages:
      - nginx
    hosts:
      - wp.dev

php:
  - 7.1
  - 7.2
  - nightly

  env:
    global:
      - COMPOSER_NO_INTERACTION=1
    matrix:
      - WP_VERSION=nightly
      - WP_VERSION=latest
      - WP_VERSION=4.9.3
      - WP_VERSION=4.8.5

before_install:
  # Install helper scripts
  - composer global require --prefer-dist "typisttech/travis-nginx-wordpress:^1.0.0"
  - export PATH=$HOME/.composer/vendor/bin:$PATH
  - tnw-install-nginx
  - tnw-install-wordpress
  - tnw-prepare-codeception

install:
  # Build the test suites
  - cd $TRAVIS_BUILD_DIR
  - composer install -n --prefer-dist
  - vendor/bin/codecept build -n

script:
	# Run the tests
  - cd $TRAVIS_BUILD_DIR
  - vendor/bin/codecept run -n --coverage --coverage-xml

after_script:
 - tnw-upload-coverage-to-scrutinizer
 - tnw-upload-coverage-to-codecov

```

And, this is an basic example of `codeception.dist.yml` which compatible with the above Travis settings:

```

# codeception.dist.yml
actor: Tester
paths:
  tests: tests
  log: tests/_output
  data: tests/_data
  helpers: tests/_support
settings:
  bootstrap: _bootstrap.php
  colors: true
  memory_limit: 1024M
coverage:
  enabled: true
  include:
    - src/my-plugin/*
  exclude:
    - src/my-plugin/partials/*
params: [env] # get parameters from environment vars
modules:
  config:
    WPDb:
      dsn: 'mysql:host=localhost;dbname=wordpress'
      user: 'root'
      password: ''
      dump: 'tests/_data/dump.sql'
      url: 'http://wp.dev:8080'
    WPBrowser:
      url: 'http://wp.dev:8080'
      adminUsername: 'admin'
      adminPassword: 'password'
      adminPath: '/wp-admin'
    WordPress:
      depends: WPDb
      wpRootFolder: '/tmp/wordpress'
      adminUsername: 'admin'
      adminPassword: 'password'
    WPLoader:
      wpRootFolder: '/tmp/wordpress'
      dbName: 'wordpress_int'
      dbHost: 'localhost'
      dbUser: 'root'
      dbPassword: ''
      tablePrefix: 'int_wp_'
      domain: 'wordpress.dev'
      adminEmail: 'admin@wordpress.dev'
    WPWebDriver:
      url: 'http://wp.dev:8080'
      port: 4444
      window_size: '1024x768'
      adminUsername: 'admin'
      adminPassword: 'password'
      adminPath: '/wp-admin'

```

Customization
-------------

[](#customization)

The default scripts install WordPress core on `/tmp/wordpress` and serve it at `http://wp.dev:8080`.

You can customize the build via environment variables. Check the variables of the functions in the [bin](./bin) director for available configuration.

How does it works?
------------------

[](#how-does-it-works)

All of the setup scripts are located in the [bin](./bin) directory and template files are in the [tpl](./tpl) directory. They are short and basic so it should be relatively easy to follow. The repository defines 6 setup scripts:

1. `tnw-install-wordpress`
    - Install WordPress
2. `tnw-install-nginx`
    - Setup Nginx to serve a website from a folder on a local domain
3. `tnw-prepare-codeception`
    - Install [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) and [WordPress coding standard](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards)
4. `tnw-upload-coverage-to-codecov`
    - Upload test coverage to [codecov.io](https://codecov.io)
5. `tnw-upload-coverage-to-scrutinizer`
    - Upload test coverage to [Scrutinizer](https://scrutinizer-ci.com)

### WordPress

[](#wordpress)

The WordPress installation is done through the [tnw-install-wordpress](./bin/tnw-install-wordpress) bash script. The basic install process goes as follows:

1. Create the WordPress database.
2. Download WordPress core.
3. Generate the `wp-config.php` file.
    - Note that `define( 'AUTOMATIC_UPDATER_DISABLED', true );` is added.
4. Install the WordPress database.

### Nginx

[](#nginx)

The Nginx installation is done through the [tnw-install-nginx](./bin/tnw-install-nginx) bash script. The basic install process goes as follows:

1. Install Nginx using the [apt addon](https://docs.travis-ci.com/user/installing-dependencies/#Installing-Packages-with-the-APT-Addon) via entries in the [.travis.yml](./.travis.yml) file.
2. Copy the configuration templates to a new directory while replacing placeholders with environment variables.
3. Start php-fpm and Nginx with our custom configuration file instead of the default.

### Codeception

[](#codeception)

The Codeception preparation is done through the [tnw-prepare-codeception](./bin/tnw-prepare-codeception) bash script. The basic install process goes as follows:

1. Replace `phantomjs` path to the TravisCI one in `codeception.yml` and `codeception.dist.yml`.
2. Create an extra database for testing.
3. Import database dump to WordPress.
4. Upgrade the WordPress database.
5. Export the WordPress database dump for later use.

Note: The `phantomjs` path must be wrapped in single quotes.

```
extensions:
  enabled:
    - Codeception\Extension\Phantoman
  config:
    Codeception\Extension\Phantoman:
      path: '/usr/bin/phantomjs'
      port: 4444
      suites: ['acceptance']

```

### Codecov.io

[](#codecovio)

The Codecov.io test coverage uploading is done through the [tnw-upload-coverage-to-codecov](./bin/tnw-upload-coverage-to-codecov) bash script. The basic install process goes as follows:

1. Run the [codecov-bash](https://github.com/codecov/codecov-bash) script.

### Scrutinizer CI

[](#scrutinizer-ci)

The Scrutinizer CI test coverage uploading is done through the [tnw-upload-coverage-to-scrutinizer](./bin/tnw-upload-coverage-to-scrutinizer) bash script. The basic install process goes as follows:

1. Download [ocular](https://github.com/scrutinizer-ci/ocular).
2. Upload the test coverage file to Scrutinizer CI.

Known Issues
------------

[](#known-issues)

- Nginx gives alert messages during start which is safe to ignore.

    ```
     $ install-nginx
    [26-Dec-2046 00:00:00] NOTICE: [pool travis] 'user' directive is ignored when FPM is not running as root
    nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

    ```

See Also
--------

[](#see-also)

- [Running Nginx as a Non-Root User](https://www.exratione.com/2014/03/running-nginx-as-a-non-root-user/)
- [Travis CI Nginx Test (the original repo)](https://github.com/tburry/travis-nginx-test)
- [Travis CI Apache Virtualhost configuration script](https://github.com/lucatume/travis-apache-setup)

Real life examples that use this package
----------------------------------------

[](#real-life-examples-that-use-this-package)

Here you go:

- [Sunny](https://github.com/Typisttech/sunny)
- [WP Cloudflare Guard](https://github.com/TypistTech/wp-cloudflare-guard)
- [All those WordPress PHP libraries I made](https://github.com/search?utf8=%E2%9C%93&q=topic%3Awordpress-php-library+org%3ATypistTech&type=Repositories)

*Add your own [here](https://github.com/TypistTech/travis-nginx-wordpress/edit/master/README.md)*

Support!
--------

[](#support)

### Donate via PayPal [![Donate via PayPal](https://camo.githubusercontent.com/b57c445af971e3e99c2d0ccdbf4fa7faa4358ba27fecc8f68459b30289f82eda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d626c75652e737667)](https://typist.tech/donate/travis-nginx-wordpress/)

[](#donate-via-paypal-)

Love Travis CI Nginx WordPress Test? Help me maintain Travis CI Nginx WordPress Test, a [donation here](https://typist.tech/donate/travis-nginx-wordpress/) can help with it.

### Why don't you hire me?

[](#why-dont-you-hire-me)

Ready to take freelance WordPress jobs. Contact me via the contact form [here](https://typist.tech/contact/) or, via email

### Want to help in other way? Want to be a sponsor?

[](#want-to-help-in-other-way-want-to-be-a-sponsor)

Contact: [Tang Rufus](mailto:tangrufus@gmail.com)

Change Log
----------

[](#change-log)

See [CHANGELOG.md](./CHANGELOG.md).

Credit
------

[](#credit)

[Travis CI Nginx WordPress Test](https://github.com/TypistTech/travis-nginx-wordpress) is originally forked from the [Travis CI Nginx Test](https://github.com/tburry/travis-nginx-test) project. Special thanks to its author [Todd Burry](https://github.com/tburry).

License
-------

[](#license)

[Travis CI Nginx WordPress Test](https://github.com/TypistTech/travis-nginx-wordpress) is released under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~83 days

Total

10

Last Release

3066d ago

Major Versions

1.2.1 → 2.0.02017-03-09

2.1.0 → 3.0.02018-02-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1b05c8ed4ea3f68173555264d0226d5faeb7f315ed9df91890c351ef576ce72?d=identicon)[TangRufus](/maintainers/TangRufus)

---

Top Contributors

[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (51 commits)")

---

Tags

acceptance-testingcodeceptioncommand-linedevtoolnginxtravis-citravis-ci-configurationwordpresswordpress-developmentphpcswordpresscodeceptiontravisnginxwpcsacceptance testwp browser

### Embed Badge

![Health badge](/badges/typisttech-travis-nginx-wordpress/health.svg)

```
[![Health](https://phpackages.com/badges/typisttech-travis-nginx-wordpress/health.svg)](https://phpackages.com/packages/typisttech-travis-nginx-wordpress)
```

###  Alternatives

[wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

1728.2M20](/packages/wp-cli-scaffold-command)[wp-cli/core-command

Downloads, installs, updates, and manages a WordPress installation.

5210.9M26](/packages/wp-cli-core-command)[wp-cli/entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.

1059.5M78](/packages/wp-cli-entity-command)[wp-cli/i18n-command

Provides internationalization tools for WordPress projects.

11711.2M62](/packages/wp-cli-i18n-command)[wp-cli/extension-command

Manages plugins and themes, including installs, activations, and updates.

909.7M75](/packages/wp-cli-extension-command)[wp-cli/checksum-command

Verifies file integrity by comparing to published checksums.

338.1M12](/packages/wp-cli-checksum-command)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
