I'm having several problems with URL paths (Drupal 7). I think they are related with nginx configuration, because I'm experiencing this problems since I migrated the site from an apache server to an nginx server. I'm not a programmer/sysadmin and new to nginx, so it's probably (99%) a simple problem of misconfiguration.

The symptoms are the following:

  • Not aliased paths (node/15 for example) works OK always
  • Aliased paths works only when I create the alias manually (node by node editing in admin/config/search/path).
  • Aliased paths created via pathauto never works (alias are created but they when you open the aliased path you get "page not found").
  • Bulk update option (admin/config/search/path/update_bulk) gives me "Access denied" after clicking the "Update" button, but works when I deactive the clean URLs (the same happens also with theme selection, flush caches and probably other things: I get "access denied" with clean URLs activated and works OK with clean URLs deactivated.

I've tried several nginx configurations found in pages related with drupal and not related with drupal, all without any luck (most give me a 502 bad gateway, like for example this http://wiki.nginx.org/Drupal).

One of the few that "works" (it gives no errors and works for non-aliased paths, but doesn't work for aliased paths) is the following:

server {
 root /path/to/drupal; 
 index index.php index.html index.htm;

 server_name example.com;

 location / {
    try_files $uri $uri/ /index.php;

 location ~ \.php$ {
    # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
  • I know nothing about nginx, but... considering the fact that the Path Alias and Path Auto modules both write to the same database table, and Path Auto doesn't even come into play when an aliased URL is resolved, my first guess would be that this is not related to nginx. Have you tried cloning the site and running it on Apache, just to see if the problem persists? – marcvangend May 27 '13 at 19:12
  • Thanks for the response, but as I've said, the site worked correctly on Apache. The problems started when I migrated the site to a new server with nginx ("cloned" using backup and migrate module for the database). – pedrogon May 27 '13 at 19:41
  • I've observed something that could have some relevance: In the alias table (admin/config/search/path), the first column (alias) links to the aliased path in the paths that I've configured manually (as it should be), but the alias created by pathauto links to the non-aliased path (for example, in the table you see "path/whatever" but when you click it, it sends you to "node/51"). – pedrogon May 27 '13 at 19:46

I'm pedrogon (the user that asked the question). I can't access my Stack Exchange account, but I've managed to solve my problem, and I want to post the solution for anybody in my situation.

I had two different problems (not related with each other) that were causing the "symptoms" described in my question:

  1. The problems with clean URLs, theme selection, etc. where caused by nginx misconfiguration. The line "try_files $uri $uri/ /index.php;" should be "try_files $uri $uri/ /index.php?q=$uri&$args;"

  2. The problems with the Pathauto module were caused by multilingual configuration. I've created nodes in one language and then turn the site to another language. Aparently the Pathauto module doesn't work in this situation. I had to change the language of all the nodes (using VBO) and then the Pathauto module started to work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.