Nginx réécrire dans un sous-dossier (404)

Je dispose d'un site héberger sur un NGINX serveur qui fonctionne bien pour enlever index.php dans nginx site configuration à l'aide de try_files.

Mais maintenant, je vais ajouter un blog sur elle, où l'URL sera www.foo.com/blog, je peux accéder au blog et l'utilisation index.php?p=.

Mais, une fois que j'utilise assez permalien avec Nginx Helper, www.foo.com/blog/2013/07/bar, je reçois 404.

server {
  # don't forget to tell on which port this server listens
  listen 80;

  # listen on the www host
  server_name foo.com;

  # and redirect to the non-www host (declared below)
  return 301 $scheme://www.ultra-case.com$request_uri;
}

server {
  # listen 80 default_server deferred; # for Linux
  # listen 80 default_server accept_filter=httpready; # for FreeBSD
  listen 80;

  # The host name to respond to
  server_name www.foo.com;

  # Path for static files
  root /web/foo.com

  #index file
  index index.php;

  #Specify a charset
  charset utf-8;

  # Custom 404 page
  error_page 404 /404.html;

  # Uri Rewrite

  location /blog {
    index index.php;
    try_files $uri $uri//blog/index.php?$args;
  }

  location / {
    autoindex on;
    # This is cool because no php is touched for static content.
    # include tihe "?$args" part so non-default permalinks doesn't break when using query string
    try_files $uri $uri/ /index.php?$args;
  }
  location ~ \.php$ {
    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    include fastcgi.conf;
    fastcgi_intercept_errors on;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
  }

  # Include the component config parts for h5bp
  include conf/h5bp.conf;
}
  • root /web/foo.com point virgule manquant
  • euh... désolé pour ma faute, c'est juste d'erreur alors que je veux caché mon vrai nom d'hôte du serveur et l'emplacement des fichiers.
InformationsquelleAutor Cauliturtle | 2013-07-23