Drupal под nginx

Краткое руководство по установке nginx + php + fastcgi + drush.

###Установка nginx, php, fastcgi

aptitude install mysql-server mysql-client

aptitude install spawn-fcgi

aptitude install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-o...
.

# aptitude install daemontools daemontools-run
server:# mkdir -p /etc/sv/spawn-fcgi
server:# cd /etc/sv/spawn-fcgi

The run script

In directory /etc/sv/spawn-fcgi, that we will call the service directory, we need a run script that will be read by the supervise program to start the processes. This run script contains the command line to start spawn-fcgi. An important argument to add is the -n switch, that will prevent spawn-fcgi to fork.
ebian ships too packages for daemontools: daemontools and daemontools-run.

# aptitude install daemontools daemontools-run

The second packages create the directory /etc/service and the script update-service. We are going to create our service directory somewhere on the system, say /etc/sv, and launch update-service to create a symlink into /etc/service and /var/lib/supervise.

Each monitored service will be composed of a directory located into /etc/sv containing a run script.

Monitoring the state of a process IMPOSES that the process does not fork, otherwise the forked process won't be monitored.

Installation of spawn-fcgi into /etc/sv can be done as follow:

server:# mkdir -p /etc/sv/spawn-fcgi
server:# cd /etc/sv/spawn-fcgi

The run script

In directory /etc/sv/spawn-fcgi, that we will call the service directory, we need a run script that will be read by the supervise program to start the processes. This run script contains the command line to start spawn-fcgi. An important argument to add is the -n switch, that will prevent spawn-fcgi to fork.

My run script for spawn-fcgi looks like the following:

server:/etc/sv/spawn-fcgi# cat run
#! /bin/sh
exec /usr/bin/spawn-fcgi -n -a 127.0.0.1 -p 9000 -u www-data -g www-data -C 5 /usr/bin/php5-cgi

Make this script executable and add this new service to the supervised services using update-service. supervise will then automatically start the process.

server:/etc/sv/spawn-fcgi# chmod +x run
server:/etc/sv/spawn-fcgi# update-service --add /etc/sv/spawn-fcgi spawn-fcgi
My run script for spawn-fcgi looks like the following:

server:/etc/sv/spawn-fcgi# chmod +x run
server:/etc/sv/spawn-fcgi# update-service --add /etc/sv/spawn-fcgi spawn-fcgi

http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:nginx:daemont...
###Разбор конфига nginx

###Сравнение nginx vs apache

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.