[spip-dev] Tweet de mhoareau

Quelqu’un a-t-il déjà fait ça ? Publié quelque part ? Gilles peut-être ? Ou Strangeblackhole ?

## Mickael Hoareau (@mhoareau)

02/07/12 19:05







Une âme charitable aurait déjà pris le temps de réécrire les rewrite rules de SPIP dans le format compréhensible par Nginx ? espoir

|

  • |




    |

Cédric

Hop,

Salut la liste,

J’ai publié ma config sur http://my.opera.com/tech-nova/blog/
La voici :

server {

  # list of standard rules
  # listen / server_name / client_max_body_size
  # location / etc..

  error_page 404 = @spip;

  location @spip {
  # SPIP handles everything

    # "html" compatibility
    # (I often remove this part)
    rewrite ^/([^/]+)/rubrique([0-9]+)(\.html)?$    /$1/spip.php?page=rubrique&id_rubrique=$2&$args    last;
    rewrite ^/([^/]+)/article([0-9]+)(\.html)?$     /$1/spip.php?page=article&id_article=$2&$args    last;
    rewrite ^/([^/]+)/breve([0-9]+)(\.html)?$       /$1/spip.php?page=breve&id_breve=$2&$args    last;
    rewrite ^/([^/]+)/mot([0-9]+)(\.html)?$   /$1/spip.php?page=mot&id_mot=$2&$args    last;
    rewrite ^/([^/]+)/auteur([0-9]+)(\.html)?$      /$1/spip.php?page=auteur&id_auteur=$2&$args    last;
    rewrite ^/([^/]+)/site([0-9]+)(\.html)?$  /$1/spip.php?page=site&id_syndic=$2&$args    last;

    # short links
    rewrite ^/([^/]*)/([1-9][0-9]*)$  /$1/spip.php?action=redirect&type=article&status=301&id=$2&$args      last;

    # standard files
    rewrite ^/([^/]*)/robots\.txt$    /$1/spip.php?page=robots.txt    last;
    rewrite ^/([^/]*)/favicon\.ico$   /$1/spip.php?page=favicon.ico   last;
    rewrite ^/([^/]*)/sitemap\.xml$   /$1/spip.php?page=sitemap.xml   last;

    # Other SPIP custom urls
    rewrite ^/([^/]*)/(.*)(\.html)?$  /$1/spip.php?url_propre=$2&$args last;
  }

}

Je prépare un tutoriel détaillé sur l’installation de SPIP avec Nginx

.Gilles