LINUX – HOW TO CONFIGURE NGINX + PHP-FPM + DRUPAL 7.0
I have configure properly Drupal7 with NGINX, PHP-FPM and APC.
The whole thing rock and has an excellent speed.
The whole thing rock and has an excellent speed.
Installation of needed packages :
1
2
3
4
|
#for ubuntu / debian based
sudo apt-get install php-apc php-pear php5-cli php5-common php5-curl php5-fpm php5-gd php5-mysql nginx
#for other, install the equivalent package
|
Configure your nginx :
1
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
server {
server_name YOURDOMAIN;
root /var/www/qa;
access_log /var/log/nginx/YOURDOMAIN.access.log;
error_log /var/log/nginx/YOURDOMAIN.error.log info;
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# This matters if you use drush
location = /backup {
deny all;
}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 127.0.0.1;
deny all;
}
location ~ \..*/.*\.php {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
}
|
No comments:
Post a Comment