Learn about Centmin Mod LEMP Stack today
Become a Member

Wordpress Drupal Any nginx gurus here? (Drupal 8)

Discussion in 'Blogs & CMS usage' started by Derek, Mar 8, 2018.

  1. Derek

    Derek Member

    43
    9
    8
    Aug 5, 2016
    Ratings:
    +21
    Local Time:
    10:45 AM
    I'm about to quit banging my head against this particular problem, but here goes:

    Fresh install of centminmod beta 9, Drupal installed via web download and script. Things mostly run. Right after the installation links wouldn't work, but reconfiguring the /etc/local/nginx/conf/conf.d/mysite.com.conf && mysite.com.ssl.conf files to include the following made most things work:
    PHP:
    location / {
    try_files $uri $uri/ @rewrite;
    expires max;
    }

    location @rewrite {
    rewrite ^/(.*)$ /index.php?q=$1;
    }
    (I actually can't tell that the second location directive does anything, but it didn't break the site, so....)

    Now, that lets me navigate most of the Drupal admin interface, but trying to add content (like a new page or article) gives me a 500 error. That means I can navigate to mysite.tld/node/add and everything looks fine, but the link to mysite.tld/node/add/article is broken and errors out. And I can't figure it out.

    The nginx recipe for Drupal lists some additional code I've tried, but this always results in cloudflare throwing a "bad gateway" error. I'm running Drupal 8 by the way:

    PHP:
        location '\.php$|^/update.php' {
            
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
            
    # Security note: If you're running a version of PHP older than the
            # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
            # See http://serverfault.com/q/627903/94922 for details.
            
    include fastcgi_params;
            
    # Block httpoxy attacks. See https://httpoxy.org/.
            
    fastcgi_param HTTP_PROXY "";
            
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            
    fastcgi_param PATH_INFO $fastcgi_path_info;
            
    fastcgi_param QUERY_STRING $query_string;
            
    fastcgi_intercept_errors on#nginx doesn't like this so I need to edit it out; apparently this is declared elsewhere
            # PHP 5 socket location.
            #fastcgi_pass unix:/var/run/php5-fpm.sock;
            # PHP 7 socket location.
            
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }
    Do any of you have any idea what I should try next? I'm done pulling my hair out and I'm going to grab a beer...
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,062
    7,912
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,195
    Local Time:
    12:45 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    moved thread for blog/cms forums also check filter for drupal prefix which when clicked on can filter forum for drupal threads some might have clues as to how nginx is setup Blogs & CMS usage -Drupal prefix tagged

    I have no experience using Drupal recent versions so you'd be on your own. Wordpress is much easier in this regards :D
     
  3. eva2000

    eva2000 Administrator Staff Member

    36,062
    7,912
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,195
    Local Time:
    12:45 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    oh don't follow that advice either you will break PHP-FPM functionality if you do
     
  4. Derek

    Derek Member

    43
    9
    8
    Aug 5, 2016
    Ratings:
    +21
    Local Time:
    10:45 AM
    Well, for now I shut down that VM and reinstalled Drupal using a stock Centos build. :(

    It works though. :)
     
    • Informative Informative x 1
..