News: Faz alguns dias que este blog está rodando em um VPS que aluguei na slicehost. Em um primeiro momento fiz a instalação Lamp padrão, contudo isso resultou em um pequeno inconveniente, consumo excessivo de memória ram:
# Consumo de memória com apache
mysql + apache2 rodando wordpress = 165 mb ram
Considerando que meu VPS tem apenas 256 mb de ram resolvi trocar o apache pelo nginx, o resultado foi bem agradável:
# Consumo de memória com nginx
mysql + fcgi + nginx rodando wordpress = 65 mb ram
O processo de instalação foi extremamente simples, e as configurações custaram alguns poucos momentos no google.
# Pacotes necessários:
apt-get install nginx mysql-server php5 php5-cgi php5-mysql spawn-fcgi
Arquivo de configuração do domínio no nginx
cat /etc/nginx/sites-enabled/tarzxvf.com
server {
listen 80;
server_name tarzxvf.com www.tarzxvf.com;
access_log /var/log/nginx/tarzxvf.com.access.log;
location / {
root /var/www/tarzxvf.com;
index index.html index.htm index.php;
# this move feed requests to feedburner
if ($http_user_agent !~ FeedBurner) {
rewrite ^/feed/ http://feeds.feedburner.com/tarzxvf last;
}
# this serves static files that exist without running other rewrite tests
if (-f $request_filename) {
expires 30d;
break;
}
# this sends all non-existing file or directory requests to index.php
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/tarzxvf.com/$fastcgi_script_name;
include fastcgi_params;
}
}
Arquivo de inicialização do fcgi
cat /etc/init.d/spawn-fcgi
#! /bin/sh
### BEGIN INIT INFO
# Provides: spawn-fcgi-php
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts FastCGI for PHP
# Description: starts FastCGI for PHP using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=spawn-fcgi-php
PID=/var/run/spawn-fcgi-php.pid
DAEMON=/usr/bin/spawn-fcgi
DAEMON_OPTS="-f /usr/bin/php-cgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -P $PID"
test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo "Starting $NAME: "
start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
echo "done."
;;
stop)
echo "Stopping $NAME: "
start-stop-daemon --stop --pidfile $PID --retry 5
rm -f $PID
echo "done."
;;
restart)
echo "Stopping $NAME: "
start-stop-daemon --stop --pidfile $PID --retry 5
rm -f $PID
echo "done..."
sleep 1
echo "Starting $NAME: "
start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
echo "done."
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
- SimpleHTTPServer
- BaseHTTPServer
- wsgi
- WebOb
- Aspen
- PEP:333
- Olha que legal, basicamente o meu problema!!
- Static (Olha que legal, basicamente resolve o meu problema!!)
- Albatross
- Spyce
- CherryPY e/ou StandaloneWSGI Server
Imagino que no final vou acabar usando o Standalone WSGI Server (engine do CherryPy) com a solução apresentada no Static. Mas até lá continuo fazendo meus testes com o CherryPy mesmo.

