Drupal 6 Hosting With nginx And PHP-FastCGI. Part 4

.
.
.
.
.
Затем, мы создаем конфигурацию nginx для нашего сайта.
nano /etc/nginx/sites-available/www.example.com
server {
listen 80;
# server_name _ # catch-all
server_name example.com www.example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;
index index.php;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
# serve static files directly
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
rewrite ^/favicon.ico$ /sites/default/themes/mytheme/favicon.ico break;
access_log off;
expires 30d;
}
# If you use the Imagecache module, you’ll need to update the location and enable this directive
#location ^~ /sites/default/files/imagecache/ {
# index index.php index.html;
# # assume a clean URL is requested, and rewrite to index.php
# if (!-e $request_filename) {
# rewrite ^/(.*)$ /index.php?q=$1 last;
# break;
# }
#}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
}
Потом, мы ее задействуем:
cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/www.example.com
И давайте перезагрузим nginx.
service nginx restart
Popularity: 2%
Этот материал находится на сайте http://compiling.ru
Оставьте свой отзыв