Question

🤔 Permalinked Posts Blank after Wordpress Migrated to Nginx from Apache

Hopeful for some guidance on an issue. Background:

My Nginx Server Block is currently as follows:

upstream php {
        server unix:/run/php-fpm/php-fpm.sock;
}

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/docosacramento.com/public_html;
        index index.php index.html index.htm;

        server_name docosacramento.com www.docosacramento.com;

        if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?q=$1 last;
        }

        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location /news {
                index index.php index.html index.htm;
                try_files $uri $uri /news/index.php?q=$uri&$args;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_cache_key $host$request_method$request_uri;
        }
}

I’m guessing that perhaps location blocks are needed for each of the 4 post categories this website has (which are news, blog, gallery, and press-release) so I created a location /news {… block for testing but that does not seem to have made any changes when visiting posts that begin with /news/. Also, I’ve been sure to run the following commands each time I’ve edited the Nginx server block:

  • sudo nginx -t
  • sudo service nginx restart
  • sudo service php5-fpm restart

Additionally, before I set “WP_DEBUG_DISPLAY” to false with define( 'WP_DEBUG_DISPLAY', false );, I was getting the following at the top of my pages:


Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50557 Library:50630 in /var/www/docosacramento.com/public_html/wp-includes/wp-db.php on line 1531

Notice: Use of undefined constant WPE_CLUSTER_ID - assumed 'WPE_CLUSTER_ID' in /var/www/docosacramento.com/public_html/wp-content/mu-plugins/wpengine-common/plugin.php on line 14

Strict Standards: Declaration of sidebar_walker::start_el() should be compatible with Walker_Page::start_el(&$output, $page, $depth = 0, $args = Array, $current_page = 0) in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php on line 52

Strict Standards: Declaration of themeslug_walker_nav_menu::start_lvl() should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php on line 52

Notice: Use of undefined constant PWP_NAME - assumed 'PWP_NAME' in /var/www/docosacramento.com/public_html/wp-content/mu-plugins/wpengine-common/wpe-sec.php on line 63

Parse error: syntax error, unexpected end of file in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/single-post.php on line 52

Is there anything else I can try or test? Please let me know! Really stumped on this! I Appreciate anyone taking a look at this issue, and thanks so much in advance for any insight!

Subscribe
Share

Update after resolving some of the errors, the only ones which remain are:


Strict Standards: Declaration of sidebar_walker::start_el() should be compatible with Walker_Page::start_el(&$output, $page, $depth = 0, $args = Array, $current_page = 0) in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php on line 0

Strict Standards: Declaration of themeslug_walker_nav_menu::start_lvl() should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php on line 0

Parse error: syntax error, unexpected end of file in /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/single-post.php on line 52

Not sure what the issue is on single-post.php… does anyone notice anything??

<?php
/*
Template Name: Base Page
*/
?>

<?php get_header(); ?>

<body>
        <div id="wrapper">
                <?php get_template_part( 'partials/page-header'); ?>
                <main id="main" role="main">
                        <section id="twocolumns">
                                <div id="content">
                                        <div class="content-holder">
                        <?php 
                        $news_bread = '';
                        if(get_post_type() == 'post') { $news_bread = '<li><a href="/news/">News</a></li>'; }
                        echo get_breadcrumbs( $post, array( 'before_all' => '<ul class="breadcrumbs"><li><a href="/">Home</a></li>' . $news_bread, 'after_all' => '</ul>', 'before_each' => '<li>', 'after_each' => '</li>') ) 
                        ?>
                        <div class="page-navigation-mobile open-close">
                                <a href="#" class="opener">Select a Section <span class="fa fa-angle-down"></span></a>
                                <div class="drop slide">
                                        <ul>
                                        </ul>
                                </div>
                        </div>
                        <?php if(get_post_type() == 'post') { ?>
                        <?php $category = get_the_category(); ?>
                                                <ul class="post-header">
                                                        <li><a href="#"><?php echo $category[0]->cat_name;?></a></li>
                                                        <li><time datetime="<?php echo get_the_date('Y-m-d'); ?>"><?php echo get_the_date('F j, Y'); ?></time></li>
                                                </ul>
                        <? }?>
                                                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                        <h1><?php the_title(); ?></h1>
                                                <?php the_content(); ?>
                        <?php endwhile; else: ?>
                                <p>Sorry, no content.</p>
                        <?php endif; ?>
                                                <?php get_template_part( 'partials/page-share'); ?>
                                        </div>
                                </div>
                                <?php get_template_part( 'partials/page-sidebar'); ?>
                        </section>
                </main>
                <?php get_template_part( 'partials/page-footer'); ?>
        </div>
        <?php get_template_part( 'partials/page-fixed-panel'); ?>
</body>

<?php get_footer(); ?>

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

UPDATE - ISSUE RESOLVED by editing the single-post.php file

Line 34 updated to

<?php } ?>