Configuration

Many of the options in the per-user NGINX staging and configuration can be configured within nginx_stage. In a default installation this configuration file is located at:

/opt/ood/nginx_stage/config/nginx_stage.yml

On a fresh installation a default configuration file is copied here with details on each of the possible options explained. In most cases it is recommended that you don’t edit this file as the chosen defaults should work out of the box for most scenarios.

Warning

Modifying application specific configuration options or URI options can have unintended consequences for some of the Open OnDemand applications, so be sure you know what you are doing.

Configuration Options

template_root (String)

the root directory containing the ERB templates used in generating the NGINX configuration files

Default

Set to default installation location

template_root: "/opt/ood/nginx_stage/templates"
Example

Use custom templates

template_root: "/path/to/my/templates"
proxy_user (String)

the user name that the Apache proxy runs as so permissions can be added to the Unix domain sockets

Default

Set to the typical apache user

proxy_user: "apache"
Example

Use a different user for the Apache proxy

proxy_user: "proxy_user"
nginx_bin (String)

the path to the NGINX binary

Default

Use NGINX 1.6 installed by Software Collections

nginx_bin: "/opt/rh/nginx16/root/usr/sbin/nginx"
Example

NGINX is installed in a different directory

nginx_bin: "/path/to/sbin/nginx"
nginx_signals (Array<String>)

valid signals that can be sent to the NGINX process

Default

Supported NGINX signals

nginx_signals: [stop, quit, reopen, reload]
Example

Further restrict valid signals

nginx_signals: [stop]

Note

This option is sent as -s signal to the NGINX command line.

mime_types_path (String)

the path to the system-installed NGINX mime.types file

Default

Use the NGINX 1.6 installed by Software Collections file

mime_types_path: "/opt/rh/nginx16/root/etc/nginx/mime.types"
Example

Use a custom mime file

mime_types_path: "/path/to/custom/mime.types"
passenger_root (String)

the locations.ini file that describes Passenger installation

Default

Use the file supplied by Passenger 4.0 installed by Software Collections

passenger_root: "/opt/rh/rh-passenger40/root/usr/share/passenger/phusion_passenger/locations.ini"
Example

Use a custom file

passenger_root: "/path/to/custom/locations.ini"
passenger_ruby (String)

the path to the Ruby binary that Passenger uses for itself and web apps

Default

Use the Ruby wrapper script supplied by this code

passenger_ruby: "/opt/ood/nginx_stage/bin/ruby"
Example

Use the binary supplied by Ruby 2.2 installed by Software Collections

passenger_ruby: "/opt/rh/rh-ruby22/root/usr/bin/ruby"
passenger_nodejs (String, null)

the path to the Node.js binary that Passenger uses for web apps

Default

Use the Node.js wrapper script supplied by this code

passenger_nodejs: "/opt/ood/nginx_stage/bin/node"
Example

Use the binary supplied by Node.js 0.10 installed by Software Collections

passenger_nodejs: "/opt/rh/nodejs010/root/usr/bin/node"
passenger_python (String, null)

the path to the Python binary that Passenger uses for web apps

Default

Use the Python wrapper script supplied by this code

passenger_python: "/opt/ood/nginx_stage/bin/python"
Example

Use the system-installed Python binary

passenger_python: "/usr/bin/python"
pun_config_path (String)

the interpolated path to the user’s PUN config file

Default

Namespace the user config files by their user name

pun_config_path: "/var/lib/nginx/config/puns/%{user}.conf"
Example

Namespace configs under user directories

pun_config_path: "/var/lib/nginx/config/puns/%{user}/nginx.conf"
pun_tmp_root (String)

the interpolated root directory used for NGINX tmp directories

Default

Namespace under user directories

pun_tmp_root: "/var/lib/nginx/tmp/%{user}"
Example

Use a custom namespace for root directory

pun_tmp_root: "/path/to/%{user}-tmp"

Warning

NGINX will store the full request body in this location before sending it to the Passenger app. The size of the disk partition this directory resides in will limit the maximum file upload size.

pun_access_log_path (String)

the interpolated path to the NGINX access log

Default

Namespace access logs under user directories

pun_access_log_path: "/var/log/nginx/%{user}/access.log"
Example

Use a custom location for the access log file

pun_access_log_path: "/custom/path/access-%{user}.log"
pun_error_log_path (String)

the interpolated path to the NGINX error log

Default

Namespace error logs under user directories

pun_error_log_path: "/var/log/nginx/%{user}/error.log"
Example

Use a custom location for the error log file

pun_error_log_path: "/custom/path/error-%{user}.log"
pun_pid_path (String)

the interpolated path to the NGINX pid file

Default

Namespace pid files under user directories

pun_pid_path: "/var/run/nginx/%{user}/passenger.pid"
Example

Use a custom location for the pid files

pun_pid_path: "/custom/path/pid-%{user}.pid"
pun_socket_path (String)

the interpolated path to the NGINX socket file

Default

Namespace socket files under user directories

pun_pid_path: "/var/run/nginx/%{user}/passenger.sock"
Example

Use a custom location for the socket files

pun_pid_path: "/custom/path/socket-%{user}.sock"

Warning

The root directory containing the Unix domain socket file will have restricted permissions so that only the Apache proxy user can access this socket file.

Danger

Currently mod_ood_proxy will only look for socket files following the format:

$OOD_PUN_SOCKET_ROOT/<user>/passenger.sock

It is not recommended to alter pun_pid_path unless you know what you are doing.

pun_sendfile_root (String)

the root directory that NGINX serves files from using sendfile

Default

Serve all files on file system

pun_sendfile_root: "/"
Example

Only serve files under home directories

pun_sendfile_root: "/home"

Warning

All URL requests to sendfile will be relative to the pun_sendfile_root. If you alter this configuration option you may break certain web applications that expect it under /.

pun_sendfile_uri (String)

the internal URL path used by NGINX to serve files from using sendfile (not directly accessible by the client browser)

Default

Serve files under a unique path

pun_sendfile_uri: "/sendfile"
Example

Server files under a custom URL path

pun_sendfile_root: "/custom/files"
pun_app_configs (Array<Hash>)

a list of interpolated hashes that define what wildcard app config file paths to include in a user’s NGINX config (the hashes are arguments for app_config_path)

Default

Serve a user’s dev apps, all shared apps, all system apps through NGINX

pun_app_configs:
  -
    env: dev
    name: "*"
    owner: "%{user}"
  -
    env: usr
    name: "*"
    owner: "*"
  -
    env: sys
    name: "*"
    owner: "*"
Example

Serve only system apps through NGINX

pun_app_configs:
  -
    env: dev
    name: "*"
    owner: "%{user}"
app_config_path (Hash)

an interpolated hash detailing the path to the NGINX app configs for each app type

Default

A recommended solution for app config locations

app_config_path:
  dev: "/var/lib/nginx/config/apps/dev/%{owner}/%{name}.conf"
  usr: "/var/lib/nginx/config/apps/usr/%{owner}/%{name}.conf"
  sys: "/var/lib/nginx/config/apps/sys/%{name}.conf"
app_root (Hash)

an interpolated hash detailing the root directory where the app is installed for each app type

Default

A recommended solution for app deployment locations

app_root:
  dev: "~%{owner}/ondemand/dev/%{name}"
  usr: "/var/www/ood/apps/usr/%{owner}/gateway/%{name}"
  sys: "/var/www/ood/apps/sys/%{name}"

Note

A common solution is to map the user shared app location as a symlink to the user’s home directory:

/var/www/ood/apps/usr/<owner>/gateway => ~<owner>/ondemand/share

This allows the owner of the app to update the app in real time as well as maintain file permissions.

Warning

Modifying this configuration option may break how the Dashboard app searches for apps.

app_request_uri (Hash)

an interpolated hash detailing the URL path used to access the given type of app (not including the base-URI)

Default

A recommended solution for app request URL’s

app_request_uri:
  dev: "/dev/%{name}"
  usr: "/usr/%{owner}/%{name}"
  sys: "/sys/%{name}"

Note

Modifying this will require you also modify app_request_regex.

Warning

Modifying this configuration option may break how the various apps link to each other.

app_request_regex (Hash)

a hash detailing the regular expressions used to determine the type of app and its corresponding parameters from a URL request (this should match what you used in app_request_uri)

Default

A recommended solution for app request URL regular expressions

app_request_regex:
  dev: "^/dev/(?<name>[-\\w.]+)"
  usr: "^/usr/(?<owner>[\\w]+)/(?<name>[-\\w.]+)"
  sys: "^/sys/(?<name>[-\\w.]+)"

Note

Modifying anything in this configuration option other than the whitelisted characters will require you modify app_request_uri as well.

app_token (Hash)

an interpolated hash detailing a uniquely identifiable string for each app

Default

A recommended solution for generating app tokens

app_token:
  dev: "dev/%{owner}/%{name}"
  usr: "usr/%{owner}/%{name}"
  sys: "sys/%{name}"

Note

Not currently used and may be deprecated in the future.

app_passenger_env (Hash)

a hash detailing the Passenger environment to run the type of app under

Default

A recommended solution for setting Passenger environments

app_passenger_env:
  dev: "development"
  usr: "production"
  sys: "production"

Warning

Modifying this configuration option can lead to unintended consequences for web apps such as issues with serving their assets.

min_uid (Integer)

the minimum user id required to start a per-user NGINX process as

Default

User id’s typically start at 1000

min_uid: 1000
Example

Using CentOS 6

min_uid: 500

Note

For RHEL6 and CentOS 6 the user id’s begin at 500.

disabled_shell (String)

restrict starting a per-user NGINX process as a user with the given shell

Default

For OSC restrictions

disabled_shell: "/access/denied"

Note

This will only restrict access to a per-user NGINX process started with the nginx_stage pun command (used by the Apache proxy). This doesn’t restrict the other administrative commands nginx_stage nginx and nginx_stage nginx_clean when manually starting and stopping the NGINX process.