If you want to install Drupal behind NGINX on Debian there is excellent documentation lying around. Sadly none of them includes all the necessary steps, which is why I write down this small compendium on how to get going.
First install PHP with fastcgi mode enabled as well as nginx
sudo apt-get install php5-fpm nginx php-pear php-apc make
pecl install uploadprogress
Now it is time to edit your /etc/nginx/nginx.conf file
user www-data;worker_processes 1;daemon off;#error_log var/log/nginx//error.log; #error_log var/log/nginx/error.log notice;#error_log var/log/nginx/error.log info;pid /var/run/nginx.pid;events { worker_connections 1024;}http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; client_max_body_size 50m; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; gzip on;# gzip_comp_level 1; gzip_proxied any;# gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; server { listen 80; server_name _; return 444; } include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*;# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_ name; }
Last but not least you will need a script to make your server available at /etc/nginx/conf/sites-available/drupal.conf
server { listen yourip:80; server_name yourdrupal.com; location / { root /var/www/drupal; index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; break; } } error_page 404 /index.php; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ .php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/drupal$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name;
}
# deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } access_log /var/log/nginx/drupal.access.log;
error_log /var/log/nginx/drupal.error.log;
}
