Instalei o nginx no meu Lubuntu 13.04 32 bit usando:
sudo apt-get install php5-fpm
sudo apt-get install mercurial libpcre3-dev libssl-dev
hg clone -r stable-1.4 http://hg.nginx.org/nginx nginx
cd nginx
auto/configure --with-http_ssl_module
make
sudo make install
Depois disso, desativei o apache:
sudo kill $(pidof apache2)
sudo update-rc.d -f apache2 remove
e eu editei o nginx.conf, que agora é:
worker_processes 1;
events
{
worker_connections 1024;
}
http
{
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server
{
listen 80;
server_name localhost;
index index.html index.php;
location /
{
root html;
index index.html index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$
{
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html
{
root html;
}
}
}
Então eu comecei o nginx, eu escrevi um script test.php dentro do diretório html com apenas
<?php
echo 'OK!';
e abri-lo dentro do navegador, mas não funciona. O erro é:
[error] 2886#0: *1 connect() failed (111: Connection refused) while
connecting to upstream, client: 127.0.0.1, server: localhost, request:
"GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host:
"localhost"
O php5-fpm parece já ter sido iniciado, pois se eu tentar o sudo php5-fpm, recebo este erro:
ERROR: An another FPM instance seems to already listen on /var/run/php5-fpm.sock