Access denied when enabling or setting by default a theme (on Nginx) I get an Access denied error page when attempting to enable or set by default a theme. It is kinda weird as I am allowed to perform other admin tasks.

I checked that my user is an administrator and it has all the permissions granted. I also made other checkings that I found in Drupal's forums and Drupal Answers but everything seems to be OK.

I have a standard install with no additional modules. Watchdog logs show the access denied warnings from http://drupal-testing/admin/appearance/enable?token=&lt;...&gt;&amp;theme=encoreweb. In addition to check the permissions of my user, I reviewed settings.php to verify $cookie_domain was commented.

I've found that I'm not the only one with this problem, but I couldn't come to a conclusion.
I've got a solution after several hours working on it.

I am using Nginx instead of Apache and I did not configure it to add the query string in the rewriting to index.php. So neither the token nor the theme parameters were reaching the script and system_theme_enable()/system_theme_default() (located in /modules/system/system.admin.inc) always returned MENU_ACCESS_DENIED, which I consider to be a very confusing behavior by the way.

This is how the server config looks like now and makes it work:

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