Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7eab3781fc
Fetching contributors…

Cannot retrieve contributors at this time

executable file 93 lines (66 sloc) 2.347 kb
#!/usr/bin/env bash
source "$extension_scripts_path/initialize"
printf "\nNote: This will do a standard install.\n"
printf "Use the 'passenger' BDSM extension for installing passenger Nginx.\n"
configure_flags=(--prefix="$nginx_install_path"
--conf-path="$nginx_config_file"
--sbin-path="$nginx_binary"
--pid-path="$nginx_pid_file"
--lock-path="$nginx_lock_file"
--http-client-body-temp-path="$nginx_spool_path/client_body_temp"
--http-proxy-temp-path="$nginx_spool_path/proxy_temp"
--http-fastcgi-temp-path="$nginx_spool_path/fastcgi_temp"
--http-log-path="$nginx_log_path/access.log"
--error-log-path="$nginx_log_path/error.log"
--with-imap
--with-imap_ssl_module
--with-http_ssl_module
--with-http_stub_status_module
--with-pcre
)
true "${source_path:=/usr/local/src}" \
"${nginx_version:=0.8.54}" \
"${archive_format:=tar.gz}"
mkdir -p "$source_path"
cd "$source_path"
package="nginx"
packge_url="http://nginx.org/download/${package}-${nginx_version}.${archive_format}"
curl -O -L "$packge_url"
tar zxf "${package}-${nginx_version}.tar.gz"
cd "${package}-${nginx_version}"
./configure ${configure_flags[@]}
make
make install
config_directories=(/var/spool/nginx/client_body_temp
/var/log/nginx
"$nginx_config_path/conf"
"$nginx_config_path/servers"
)
for directory in "${config_directories[@]}" ; do
mkdir -p "$directory"
done
files=( fastcgi.conf fastcgi.conf.default fastcgi_params
fastcgi_params.default koi-utf koi-win mime.types mime.types.default
nginx.conf.default scgi_params scgi_params.default uwsgi_params
uwsgi_params.default win-utf
)
for file in "${files[@]}" ; do
if [[ -f "$nginx_path/$file" ]] ; then
mv "$nginx_path/$file" \
"$nginx_config_path/$file"
fi
done
touch "$nginx_config_path/passenger" # empty file as a placeholder.
cp "$extension_templates_path/nginx_ctl.template" \
"$init_scripts_path/nginx"
chmod +x "$init_scripts_path/nginx"
cp "$extension_templates_path/nginx.conf.template" \
"$nginx_config_path/nginx.conf"
cp "$extension_templates_path/proxy.conf.template" \
"$nginx_config_path/conf/proxy.conf"
# TODO: better handling of already exising nginx user here
groupadd nginx 2>/dev/null
useradd -G nginx -M nginx 2>/dev/null
for directory in "${config_directories[@]}" ; do
chown -R nginx:nginx "$directory"
done
Jump to Line
Something went wrong with that request. Please try again.