forked from e621ng/e621ng
fix install script to work with unicorn
This commit is contained in:
parent
60617c7c81
commit
00908a7ace
@ -13,7 +13,7 @@ echo "you should be able to connect to the server and create an account."
|
||||
echo
|
||||
echo "It will create a new user called danbooru which will run the Danbooru"
|
||||
echo "processes. It will download the latest copy and install it in"
|
||||
echo "/var/www/danbooru."
|
||||
echo "/var/www/danbooru2."
|
||||
echo
|
||||
echo -n "Enter the hostname for this server (ex: danbooru.donmai.us): "
|
||||
read HOSTNAME
|
||||
@ -35,7 +35,7 @@ fi
|
||||
# Install packages
|
||||
echo "Installing packages..."
|
||||
apt-get update
|
||||
apt-get -y install build-essential automake openssl libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf ncurses-dev sudo gcc g++ libreadline-dev zlib1g-dev flex bison bzip2 ragel memcached libmemcache-dev git curl libcurl4-openssl-dev emacs imagemagick libmagickcore-dev libmagickwand-dev sendmail psmisc postgresql postgresql-contrib libpq-dev
|
||||
apt-get -y install build-essential automake openssl libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf ncurses-dev sudo gcc g++ libreadline-dev zlib1g-dev flex bison bzip2 ragel memcached libmemcache-dev git curl libcurl4-openssl-dev emacs imagemagick libmagickcore-dev libmagickwand-dev sendmail-bin sendmail psmisc postgresql postgresql-contrib libpq-dev
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
@ -68,35 +68,42 @@ sudo -u danbooru git clone git://github.com/sstephenson/ruby-build.git /home/dan
|
||||
sudo -u danbooru bash -l -c "rbenv install $RUBY_VERSION"
|
||||
sudo -u danbooru bash -l -c "rbenv global $RUBY_VERSION"
|
||||
|
||||
#Generate secret token and secret key
|
||||
sudo -u danbooru mkdir /home/danbooru/.danbooru/
|
||||
sudo -u danbooru openssl rand -hex 32 > /home/danbooru/.danbooru/secret_token
|
||||
sudo -u danbooru openssl rand -hex 32 > /home/danbooru/.danbooru/session_secret_key
|
||||
chmod 600 /home/danbooru/.danbooru/session_secret_key
|
||||
chmod 600 /home/danbooru/.danbooru/secret_token
|
||||
chown -R danbooru:danbooru /home/danbooru/.danbooru/
|
||||
|
||||
# Install gems
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc capistrano'
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc capistrano-ext'
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc bundler'
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc whenever'
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc capistrano-unicorn'
|
||||
|
||||
# Install Passenger
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc -v 3.0.17 passenger'
|
||||
/home/danbooru/.rbenv/versions/$RUBY_VERSION/bin/passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx
|
||||
rm -f /opt/nginx/conf/*.default
|
||||
# Install Nginx
|
||||
curl http://nginx.org/keys/nginx_signing.key > /root/nginx_signing.key
|
||||
apt-key add nginx_signing.key
|
||||
echo "deb http://nginx.org/packages/debian/ squeeze nginx" >> /etc/apt/sources.list
|
||||
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" >> /etc/apt/sources.list
|
||||
apt-get update
|
||||
apt-get -y install nginx
|
||||
rm -f /etc/nginx/conf.d/*.conf
|
||||
|
||||
# Update PostgreSQL
|
||||
PG_HBA_FILE="/etc/postgresql/9.1/main/pg_hba.conf"
|
||||
PG_HBA_FILE="/etc/postgresql/8.4/main/pg_hba.conf"
|
||||
echo "local all postgres,danbooru trust" > $PG_HBA_FILE
|
||||
echo "host all postgres,danbooru 127.0.0.1/32 trust" >> $PG_HBA_FILE
|
||||
|
||||
/etc/init.d/postgresql restart
|
||||
sudo -u postgres createuser -s danbooru
|
||||
|
||||
mkdir -p /var/www
|
||||
mkdir -p /var/log/www
|
||||
|
||||
# Setup nginx
|
||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/init_d.templ > /etc/init.d/nginx
|
||||
chmod +x,g-w /etc/init.d/nginx
|
||||
update-rc.d -f nginx defaults
|
||||
mkdir -p /opt/nginx/conf/sites
|
||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.conf > /opt/nginx/conf/nginx.conf
|
||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /opt/nginx/conf/sites/danbooru.conf
|
||||
sed -i -e 's/__hostname__/$HOSTNAME/g' /opt/nginx/conf/sites/danbooru.conf
|
||||
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /etc/nginx/conf.d/danbooru.conf
|
||||
sed -i -e "s/__hostname__/$HOSTNAME/g" /etc/nginx/conf.d/danbooru.conf
|
||||
/etc/init.d/nginx start
|
||||
|
||||
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
|
||||
@ -104,15 +111,15 @@ echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
|
||||
# Setup logrotate
|
||||
LOGROTATE_CONF_FILE="/etc/logrotate.conf"
|
||||
echo >> $LOGROTATE_CONF_FILE
|
||||
echo "/var/log/www/danbooru.access.log" >> $LOGROTATE_CONF_FILE
|
||||
echo "/var/log/www/danbooru.error.log">> $LOGROTATE_CONF_FILE
|
||||
echo "/var/www/danbooru/current/log/production.log {" >> $LOGROTATE_CONF_FILE
|
||||
echo "/var/www/danbooru2/current/log/production.log {" >> $LOGROTATE_CONF_FILE
|
||||
echo " daily" >> $LOGROTATE_CONF_FILE
|
||||
echo " rotate 3" >> $LOGROTATE_CONF_FILE
|
||||
echo " copytruncate" >> $LOGROTATE_CONF_FILE
|
||||
echo "}" >> $LOGROTATE_CONF_FILE
|
||||
|
||||
sudo -u danbooru createdb danbooru2
|
||||
sudo -u danbooru psql danbooru2 -c 'CREATE LANGUAGE plpgsql;'
|
||||
|
||||
cd /home/danbooru
|
||||
sudo -u danbooru mkdir /home/danbooru/apps
|
||||
cd /home/danbooru/apps
|
||||
@ -122,7 +129,7 @@ chown -R danbooru:danbooru danbooru
|
||||
echo
|
||||
echo
|
||||
echo "**************************************************************"
|
||||
echo "* Danbooru is now ready for deployment. *"
|
||||
echo "* Danbooru is almost ready for deployment. *"
|
||||
echo "* *"
|
||||
echo "* A local copy has been checked out into /home/danbooru/apps *"
|
||||
echo "* but you may want to clone your own copy from *"
|
||||
@ -130,11 +137,19 @@ echo "* http://github.com/r888888888/danbooru.git *"
|
||||
echo "* *"
|
||||
echo "* You will probably want to create your own branch and *"
|
||||
echo "* modify the config/deploy/staging.rb and production.rb *"
|
||||
echo "* files to point to the correct servers. Then run: *"
|
||||
echo "* files to point to the correct servers. *"
|
||||
echo "* *"
|
||||
echo "* You will also need to edit config/deploy.rb and replace *"
|
||||
echo "* albert with danbooru. Then run: *"
|
||||
echo "* *"
|
||||
echo "* cap deploy:setup && cap deploy *"
|
||||
echo "* This will run as staging environment *"
|
||||
echo "* *"
|
||||
echo "* cap production deploy:setup && cap production deploy *"
|
||||
echo "* This will run as production environment *"
|
||||
echo "* *"
|
||||
echo "* The first account will automatically be made an admin. *"
|
||||
echo "* You can edit the configuration files by editing *"
|
||||
echo "* /var/www/danbooru/shared/config/local_config and *"
|
||||
echo "* /var/www/danbooru/shared/config/database.yml *"
|
||||
echo "* /var/www/danbooru2/shared/config/local_config and *"
|
||||
echo "* /var/www/danbooru2/shared/config/database.yml *"
|
||||
echo "**************************************************************"
|
||||
|
@ -1,399 +0,0 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nginx
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
|
||||
# Description: nginx init.d dash script for Ubuntu <=9.10.
|
||||
### END INIT INFO
|
||||
#------------------------------------------------------------------------------
|
||||
# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx
|
||||
# daemon for ubuntu 9.10 and lesser version numbered releases.
|
||||
#
|
||||
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
|
||||
# proxy and IMAP/POP3 proxy server. This \
|
||||
# script will manage the initiation of the \
|
||||
# server and it's process state.
|
||||
#
|
||||
# processname: nginx
|
||||
# config: /opt/nginx/conf/nginx.conf
|
||||
# pidfile: /opt/nginx/logs/nginx.pid
|
||||
# Provides: nginx
|
||||
#
|
||||
# Authoer: Andrew Carter
|
||||
# <ascarter@gmail.com>
|
||||
#
|
||||
# Version: 0.1 27-DEC-2010 ascarter@gmail.com
|
||||
# Notes: Forked from original script to support default Passenger nginx
|
||||
# install via RVM.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# MIT X11 License
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2010 Andrew Carter
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# ORIGINAL SCRIPT:
|
||||
#
|
||||
# Author: Jason Giedymin
|
||||
# <jason.giedymin AT gmail.com>.
|
||||
#
|
||||
# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com
|
||||
# URL: http://code.google.com/p/nginx-init-ubuntu/
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# MIT X11 License
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2009 Jason Giedymin, http://Amuxbit.com formerly
|
||||
# http://AcronymLabs.com
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Functions
|
||||
#------------------------------------------------------------------------------
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Consts
|
||||
#------------------------------------------------------------------------------
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/opt/nginx/sbin/nginx
|
||||
|
||||
PS="nginx"
|
||||
PIDNAME="nginx" #lets you do $PS-slave
|
||||
PIDFILE=$PIDNAME.pid #pid file
|
||||
PIDSPATH=/var/run
|
||||
|
||||
DESCRIPTION="Nginx Server..."
|
||||
|
||||
RUNAS=root #user to run as
|
||||
|
||||
SCRIPT_OK=0 #ala error codes
|
||||
SCRIPT_ERROR=1 #ala error codes
|
||||
TRUE=1 #boolean
|
||||
FALSE=0 #boolean
|
||||
|
||||
lockfile=/var/lock/subsys/nginx
|
||||
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Simple Tests
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#test if nginx is a file and executable
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
# Include nginx defaults if available
|
||||
if [ -f /etc/default/nginx ] ; then
|
||||
. /etc/default/nginx
|
||||
fi
|
||||
|
||||
#set exit condition
|
||||
#set -e
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
setFilePerms(){
|
||||
|
||||
if [ -f $PIDSPATH/$PIDFILE ]; then
|
||||
chmod 400 $PIDSPATH/$PIDFILE
|
||||
fi
|
||||
}
|
||||
|
||||
configtest() {
|
||||
$DAEMON -t -c $NGINX_CONF_FILE
|
||||
}
|
||||
|
||||
getPSCount() {
|
||||
return `pgrep -f $PS | wc -l`
|
||||
}
|
||||
|
||||
isRunning() {
|
||||
if [ $1 ]; then
|
||||
pidof_daemon $1
|
||||
PID=$?
|
||||
|
||||
if [ $PID -gt 0 ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
pidof_daemon
|
||||
PID=$?
|
||||
|
||||
if [ $PID -gt 0 ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#courtesy of php-fpm
|
||||
wait_for_pid () {
|
||||
try=0
|
||||
|
||||
while test $try -lt 35 ; do
|
||||
|
||||
case "$1" in
|
||||
'created')
|
||||
if [ -f "$2" ] ; then
|
||||
try=''
|
||||
break
|
||||
fi
|
||||
;;
|
||||
|
||||
'removed')
|
||||
if [ ! -f "$2" ] ; then
|
||||
try=''
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#echo -n .
|
||||
try=`expr $try + 1`
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
status(){
|
||||
isRunning
|
||||
isAlive=$?
|
||||
|
||||
if [ "${isAlive}" -eq $TRUE ]; then
|
||||
echo "$PIDNAME found running with processes: `pidof $PS`"
|
||||
else
|
||||
echo "$PIDNAME is NOT running."
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
removePIDFile(){
|
||||
if [ $1 ]; then
|
||||
if [ -f $1 ]; then
|
||||
rm -f $1
|
||||
fi
|
||||
else
|
||||
#Do default removal
|
||||
if [ -f $PIDSPATH/$PIDFILE ]; then
|
||||
rm -f $PIDSPATH/$PIDFILE
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
log_daemon_msg "Starting $DESCRIPTION"
|
||||
|
||||
isRunning
|
||||
isAlive=$?
|
||||
|
||||
if [ "${isAlive}" -eq $TRUE ]; then
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
else
|
||||
start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \
|
||||
-- -c $NGINX_CONF_FILE
|
||||
setFilePerms
|
||||
log_end_msg $SCRIPT_OK
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
log_daemon_msg "Stopping $DESCRIPTION"
|
||||
|
||||
isRunning
|
||||
isAlive=$?
|
||||
if [ "${isAlive}" -eq $TRUE ]; then
|
||||
start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE
|
||||
|
||||
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
|
||||
|
||||
if [ -n "$try" ] ; then
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
else
|
||||
removePIDFile
|
||||
log_end_msg $SCRIPT_OK
|
||||
fi
|
||||
|
||||
else
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
fi
|
||||
}
|
||||
|
||||
reload() {
|
||||
configtest || return $?
|
||||
|
||||
log_daemon_msg "Reloading (via HUP) $DESCRIPTION"
|
||||
|
||||
isRunning
|
||||
if [ $? -eq $TRUE ]; then
|
||||
kill -HUP `cat $PIDSPATH/$PIDFILE`
|
||||
|
||||
log_end_msg $SCRIPT_OK
|
||||
else
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
fi
|
||||
}
|
||||
|
||||
quietupgrade() {
|
||||
log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION"
|
||||
|
||||
isRunning
|
||||
isAlive=$?
|
||||
if [ "${isAlive}" -eq $TRUE ]; then
|
||||
kill -USR2 `cat $PIDSPATH/$PIDFILE`
|
||||
kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin`
|
||||
|
||||
isRunning
|
||||
isAlive=$?
|
||||
if [ "${isAlive}" -eq $TRUE ]; then
|
||||
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
|
||||
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
|
||||
removePIDFile $PIDSPATH/$PIDFILE.oldbin
|
||||
|
||||
log_end_msg $SCRIPT_OK
|
||||
else
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
|
||||
log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION"
|
||||
|
||||
kill -HUP `cat $PIDSPATH/$PIDFILE`
|
||||
kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin`
|
||||
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
|
||||
|
||||
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
|
||||
removePIDFile $PIDSPATH/$PIDFILE.oldbin
|
||||
|
||||
log_end_msg $SCRIPT_ok
|
||||
fi
|
||||
else
|
||||
log_end_msg $SCRIPT_ERROR
|
||||
fi
|
||||
}
|
||||
|
||||
terminate() {
|
||||
log_daemon_msg "Force terminating (via KILL) $DESCRIPTION"
|
||||
|
||||
PIDS=`pidof $PS` || true
|
||||
|
||||
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
|
||||
|
||||
for i in $PIDS; do
|
||||
if [ "$i" = "$PIDS2" ]; then
|
||||
kill $i
|
||||
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
|
||||
removePIDFile
|
||||
fi
|
||||
done
|
||||
|
||||
log_end_msg $SCRIPT_OK
|
||||
}
|
||||
|
||||
destroy() {
|
||||
log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION"
|
||||
killall $PS -q >> /dev/null 2>&1
|
||||
log_end_msg $SCRIPT_OK
|
||||
}
|
||||
|
||||
pidof_daemon() {
|
||||
PIDS=`pidof $PS` || true
|
||||
|
||||
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
|
||||
|
||||
for i in $PIDS; do
|
||||
if [ "$i" = "$PIDS2" ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|force-reload)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
reload)
|
||||
$1
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
configtest)
|
||||
$1
|
||||
;;
|
||||
quietupgrade)
|
||||
$1
|
||||
;;
|
||||
terminate)
|
||||
$1
|
||||
;;
|
||||
destroy)
|
||||
$1
|
||||
;;
|
||||
*)
|
||||
FULLPATH=/etc/init.d/$PS
|
||||
echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}"
|
||||
echo " The 'destroy' command should only be used as a last resort."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -1,30 +0,0 @@
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
use epoll;
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
passenger_root /home/danbooru/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/passenger-3.0.17;
|
||||
passenger_ruby /home/danbooru/.rbenv/versions/1.9.3-p327/bin/ruby;
|
||||
passenger_user_switching on;
|
||||
passenger_default_user danbooru;
|
||||
rails_spawn_method smart;
|
||||
passenger_max_pool_size 3;
|
||||
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
|
||||
gzip on;
|
||||
gzip_http_version 1.1;
|
||||
gzip_vary off;
|
||||
gzip_comp_level 6;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_buffers 16 8k;
|
||||
|
||||
include /opt/nginx/conf/sites/*.conf;
|
||||
}
|
25
script/install/nginx.danbooru.conf
Executable file → Normal file
25
script/install/nginx.danbooru.conf
Executable file → Normal file
@ -1,11 +1,10 @@
|
||||
server {
|
||||
passenger_enabled on;
|
||||
listen 80;
|
||||
server_name __hostname__;
|
||||
root /var/www/danbooru/current/public;
|
||||
root /var/www/danbooru2/current/public;
|
||||
index index.html;
|
||||
access_log /var/log/www/danbooru.access.log;
|
||||
error_log /var/log/www/danbooru.error.log;
|
||||
access_log /var/log/nginx/danbooru.access.log;
|
||||
error_log /var/log/nginx/danbooru.error.log;
|
||||
client_max_body_size 30m;
|
||||
location /stylesheets {
|
||||
expires max;
|
||||
@ -30,6 +29,22 @@ server {
|
||||
rewrite ^(.*)$ /maintenance.html last;
|
||||
break;
|
||||
}
|
||||
location @app_server {
|
||||
proxy_pass http://app_server;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Proto http;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri @app_server;
|
||||
}
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /500.html;
|
||||
}
|
||||
}
|
||||
|
||||
upstream app_server {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user