centOs+passenger+nginx+rails+mysql环境搭建 - 白牙的日志 - 努力哇!
centOs+passenger+nginx+rails+mysql环境搭建
yum groupinstall "Development Tools"
yum install zlib-devel wget openssl-devel
wget http://rubyforge.org/frs/download.php/66162/ruby-enterprise-1.8.7-2009.10.tar.gz
tar xzvf ruby-enterprise*
./ruby-enterprise*/installer
export PATH=$PATH:/opt/ruby/bin
wget http://www.nginx.eu/download/sources/nginx-0.8.9.tar.gz
wet http://rubyforge.org/frs/download.php/63009/passenger-2.2.5.tar.gz
tar xzvf passenger*.tar.gz
./opt/ruby/bin/passenger-install-nginx-module
1
2
/home/nginx-0.8.9
--with-http_ssl_module
vim /etc/rc.d/init.d/nginx
#!/bin/sh
#
# nginx – this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/opt/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $”Reloading $prog: ”
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
chmod +x /etc/rc.d/init.d/nginx
chkconfig --add nginx
chkconfig --level 35 nginx on
yum install mysql mysql-server mysql-devel
gem install mysql --no-rdoc --no-ri -- --with-mysql-dir=/usr/bin \
--with-mysql-lib=/usr/lib/mysql --with-mysql-include=/usr/include/mysql
chkconfig mysqld on ; /etc/init.d/mysqld start
wget http://kernel.org/pub/software/scm/git/git-1.6.5.2.tar.gz
tar zxvf git-1.6.5.2.tar.gz
./git*/configure
make
make install
配置Spree
mkdir /www
git clone git://github.com/railsdog/spree.git spree
http://github.com/railsdog/spree
useradd www-data
chown www-data /www/spree/public/javascripts
chown www-data /www/spree/public/stylesheets
chmod 0777 /www/spree/public/javascripts
chmod 0777 /www/spree/public/stylesheets
chmod u+g /www/spree/public/stylesheets
chmod u+g /www/spree/public/javascripts