Configure an Agavi Site with NGINX (using PHP-FPM)
I was used to configure my Agavi site with Lighttpd and recently switched to Nginx. The setup for Nginx was not so common to me, so I decided to write down what I had to do to configure it properly. Here is an example for dracoblue.net. Please change the parts of the script to suit your needs (the necessary parts are highlighted with "HINT:").
First of all install php5-fpm. On ubuntu I did it this way:
Now create a new file:
And add the following:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
listen dracoblue.net:80;
# HINT: Add the servername, so Agavi is able to see that it's dracoblue.net
# Otherwise you'll get something like "localhost" here
server_name dracoblue.net;
location / {
# HINT: The directory where index.php is
root /home/dracobluenet/tags/1.0.0/pub;
index index.php;
# HINT: All files except those in "static" should be served by index.php
location ~* ^/(favicon.ico|robots.txt|static) {
break;
}
# HINT: All files except those in "static" should be served by index.php
if ($uri !~ "^/(favicon.ico|robots.txt|static|index.php)") {
rewrite ^/([^?]*)$ /index.php?/$1 last;
}
}
location ~ \.php($|/) {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
# HINT: The directory where index.php is + $fastcgi_script_name
fastcgi_param SCRIPT_FILENAME /home/dracobluenet/tags/1.0.0/pub$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
As you can see, for projects I usually have only a "static" folder which is not served by agavi. This keeps the amount of work low, which nginx needs to do for each request to decide whether it should be served by php or not. I also added robots.txt and favicon.ico since you usually have them in root, too.
Restart nginx.
Messages
oh Good
mi piace farlo
oh Good
PRO f
ss
Hi
quierooo jugar
thank you everyvone lets play a game
Saya niad
Welcome)
wecloom
wau genial
nose well as install and are a part of me went auto_install to choose the skin and eleji but I get online server but will not open that alludame ago my email is bladielpapi_18@hotmail.com Spanish ablo ment I use the google translator please help me to ablarte
Escuchar
Leer fonéticamente
Diccionario - Ver diccionario detallado
Entsprechend auch bei .txt und .php?
Sollte in dem Regexp bei favicon.ico der Punkt nicht escaped werden?




