Wordpress+Nginx+super cache help!

I am running wordpress with super cache for my site. I have just installed nginx for my server. Do I need to stop the service for apache? But when I stop the service for apache, it just shows the default nginx white page. And my website is gone. Can anyone help

11 Replies

Yes, best to stop apache, unless you're proxying PHP to it or running it on another port.

Have you configured nginx for your site ? It's unlikely to have picked up your existing settings automatically.

K, I got my wordpress site working with nginx. I read that I need to change the nginx config files to make it working properly with wordpress super cache? Is it true? What changes do I need to make?

I've never used wordpress, but from a quick google, yes, you'll have to set up a few rewrite rules at the very least.

I have put in the rewrite rules for permalink for wordpress, but I kept getting 404 messages when I browse to other pages only the homepage works. Anyone can help?

server {
    listen   80;
    server_name www.topdesignblogs.com topdesignblogs.com;
    access_log /home/tony/public_html/topdesignblogs.com/logs/access.log;
    error_log /home/tony/public_html/topdesignblogs.com/logs/error.log;

    location / {
        root   /home/tony/public_html/topdesignblogs.com/public;
        index  index.php;
if (!-e $request_filename) {
  rewrite  ^(.*)$  /index.php?q=$1  last;
  break;
}
   }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME /home/tony/public_html/topdesignblogs.com/public$fastcgi_script_name;
      fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
      fastcgi_param  REQUEST_URI      $request_uri;
      fastcgi_param  DOCUMENT_URI     $document_uri;
      fastcgi_param  DOCUMENT_ROOT    $document_root;
      fastcgi_param  REMOTE_ADDR        $remote_addr;
      fastcgi_param  REMOTE_PORT        $remote_port;
      fastcgi_param  SERVER_ADDR        $server_addr;
      fastcgi_param  SERVER_PORT        $server_port;
      fastcgi_param  SERVER_NAME        $server_name;
      fastcgi_param  QUERY_STRING     $query_string;
      fastcgi_param  REQUEST_METHOD   $request_method;
      fastcgi_param  CONTENT_TYPE     $content_type;
      fastcgi_param  CONTENT_LENGTH   $content_length;
    }
}

Broswser Error Message:

Not Found

The requested URL /uncategorized/test/ was not found on this server.

Apache/2.2.8 (Ubuntu) mod_perl/2.0.3 Perl/v5.8.8 Server at topdesignblogs.com Port 80

How are you handling your cgi requests ? Nginx won't handle these on it's own – you'll need to pass them on to a fastcgi server such as php-fpm, spawn-fcgi (from lighttpd) or php5-cgi.

Alternatively, you can keep apache running on a different port, and use it purely as a cgi processor.

I'm handling using php5-cgi but it still doesn't work.

Are your php processes running ? Can you process php commands manually ?

Which port is the master listening on ? Does this match the port in your nginx configuration (9000) ?

Can you read a phpinfo() page ?

@illusime:

The requested URL /uncategorized/test/ was not found on this server.

Apache/2.2.8 (Ubuntu) mod_perl/2.0.3 Perl/v5.8.8 Server at topdesignblogs.com Port 80

That message is coming from apache, nginx isn't serving your pages, I imagine nginx isn't even running since apache is using port 80 nginx won't be able to bind to it.

Stop apache, disable it from running at startup (or just remove it all together) then start nginx.

> That message is coming from apache

Well spotted :)

I have managed to solve the nginx and it is running without apache. I have a problem after activating wordpress super cache.

When I look at the source code I cannot find:

"Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS".

Instead I see this:

Is the wordpress super cache working? Or is it supposed to be like this with nginx?

@illusime:

Is the wordpress super cache working? Or is it supposed to be like this with nginx?
Refresh. If it is still generated dynamically, your rewrite rules are wrong.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct