perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
854 stars 246 forks source link

Some links for the advanced help module don't work #174

Open jkounis opened 10 years ago

jkounis commented 10 years ago

The only advanced help links that work with these configuration files are links that match the pattern ^/help/[^/]*/README.txt$. The problem is that advanced help does not only serve files that end with README.txt. For example, the advanced help module itself has help files with the following URIs:

All of these generate 404 errors with the current Drupal 7 configuration.

I suggest the attached patch as a way to generalize the handling of advanced help URIs.


diff --git a/apps/drupal/drupal.conf b/apps/drupal/drupal.conf
index 0679bf4..bd7daa4 100644
--- a/apps/drupal/drupal.conf
+++ b/apps/drupal/drupal.conf
@@ -195,7 +195,6 @@ location / {

     ## Advanced Help module makes each module provided README available.
     location ^~ /help/ {
-        location ~* ^/help/[^/]*/README\.txt$ {
             ## Include the specific FastCGI configuration. This is for a
             ## FCGI backend like php-cgi or php-fpm.
             include apps/drupal/fastcgi_drupal.conf;
@@ -205,7 +204,6 @@ location / {
             ## uncomment the two lines below.
             #proxy_pass http://phpapache/index.php?q=$uri;
             #proxy_set_header Connection '';
-        }
     }

     ## Replicate the Apache  directive of Drupal standard
perusio commented 10 years ago

Hello,

Thanks for your question. This has a very simple solution. Try this:

     ## Advanced Help module makes each module provided README available.
     location ^~ /help/ {
         location ~* ^/help/[^/]*/(?:advanced_help/[[:alpha:]]*|README\.txt)$ {
             ## Include the specific FastCGI configuration. This is for a
             ## FCGI backend like php-cgi or php-fpm.
             include apps/drupal/fastcgi_drupal.conf;
         }   
     }
jkounis commented 10 years ago

Thank you perusio. You pointed me in the right direction. Those exact location strings did not work for me, but modified versions worked. The location string you provided seems to require help//advanced_help; however, the paths I need are in the format help/advanced_help/. There is also a path help/devel/README_devel_nodeaccess.txt that needs to work too. Finally, [[:alpha:]] did not work for me because paths have "-" and "" characters in them.

I changed it as follows:

     ## Advanced Help module makes each module provided README available.
     location ^~ /help/ {
         location ~* ^/help/(?:advanced_help/[A-Za-z0-9_-]*|[^/]*/README[^/]*\.txt)$ {
             ## Include the specific FastCGI configuration. This is for a
             ## FCGI backend like php-cgi or php-fpm.
             include apps/drupal/fastcgi_drupal.conf;
         }   
     }

Or simply:

     ## Advanced Help module makes each module provided README available.
     location ^~ /help/ {
         location ~* ^/help/(?:advanced_help/[^/]*|[^/]*/README[^/]*\.txt)$ {
             ## Include the specific FastCGI configuration. This is for a
             ## FCGI backend like php-cgi or php-fpm.
             include apps/drupal/fastcgi_drupal.conf;
         }   
     }