From Joomla! Documentation

This page is a translated version of the page Nginx and the translation is 15% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎português do Brasil • ‎русский • ‎中文(台灣)‎

Nginx is a lightweight Web server that powers about 33% of Web servers across all domains. Unless you have specific requirements that demand a heavy Web server like Apache, you are much better off using Nginx.

Below are instructions on how to get Joomla! running with PHP FastCGI Example.

Para Ubuntu, execute aptitude install nginx. Para outras distribuições, execute o gerenciador de pacote correspondente, or ver no ://

Instalar PHP FastCGI

Para Ubuntu, leia esse excelente página de como configurar PHP e FastCGI para nginx.

For Gentoo, PHP will run as a FastCGI service (FPM), so the Nginx server will run PHP as a separate process:

# echo "dev-lang/php gd gd2 curl simplexml tokenizer dom tidy sqlite xml fpm cgi" >> /etc/portage/package.use
# emerge php

The default settings of PHP-FPM are good for most servers. For special configurations, visit the PHP FPM site.

Configurar Nginx

arquivo de configuração do nginx reside em:

  • /etc/nginx/sites-available/ on Ubuntu (for sites running on that Nginx instance)
  • /etc/nginx/nginx.conf on Gentoo and Raspbian (Debian optimized for Raspberry Pi)

Here is an sample Nginx configuration file, joomla.conf, that you can reuse over all your Nginx enabled-sites.

server {
  listen 80;
    server_name YOUR_DOMAIN;
    server_name_in_redirect off;

    access_log /var/log/nginx/localhost.access_log;
    error_log /var/log/nginx/localhost.error_log info;

    root PATH_ON_SERVER;
    index index.php index.html index.htm default.html default.htm;
    # Support Clean (aka Search Engine Friendly) URLs
    location / {
        try_files $uri $uri/ /index.php?$args;

    # add global x-content-type-options header
    add_header X-Content-Type-Options nosniff;

    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;

    location ~ \.php$ {
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;

    # caching of files 
    location ~* \.(ico|pdf|flv)$ {
        expires 1y;

    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
        expires 14d;


Pay attention to a few things:

  1. The parameter fastcgi_pass is set to, corresponding to the port that FPM is configured to listen to. This means you can run the PHP processes on separate servers. On Gentoo, you can find this configuration in the /etc/php/fpm-php5.3/php-fpm.conf/ file.
  1. Don't forget to replace YOUR_DOMAIN & PATH_ON_SERVER above depending on your domain and the path of Joomla on your server.

GZip Support

If you need GZip compression support, add the following section to the http section of the main Nginx configuration file:

gzip on;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript application/javascript application/x-javascript
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";