Need Help Configuring Nginx to run Wordpress

HonDev Developer developerhondev at gmail.com
Thu Apr 24 03:22:27 MSD 2008


What version of Nginx are you using?

Thanks for the tip on php-fpm Mike I'll give it a whirl.

On Thu, Apr 24, 2008 at 7:18 AM, mike <mike503 at gmail.com> wrote:
> 1) stop using spawn-fcgi. it sucks. use php-fpm. that's not the fix to
>  your issue, but it is something i recommend. :)
>
>  here is my (working) nginx conf for wordpress (with friendly URLs enabled)
>
>  the actual wordpress install is hosted in /wordpress, but the urls are
>  all /2008/etc/ and such off the root.
>
>  server {
>     listen 80;
>     server_name michaelshadle.com www.michaelshadle.com;
>     index index.php;
>     root /home/mike/web/michaelshadle.com/;
>     location ~ .php$ {
>         include /etc/nginx/fastcgi.conf;
>         fastcgi_pass 127.0.0.1:11000;
>         fastcgi_index index.php;
>     }
>     if (!-e $request_filename) {
>         rewrite ^(.+)$ /wordpress/index.php?q=$1 last;
>     }
>  }
>
>  fastcgi.conf:
>
>
>  fastcgi_param  QUERY_STRING       $query_string;
>  fastcgi_param  REQUEST_METHOD     $request_method;
>  fastcgi_param  CONTENT_TYPE       $content_type;
>  fastcgi_param  CONTENT_LENGTH     $content_length;
>
>  fastcgi_param  SCRIPT_FILENAME    $document_root$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  SERVER_PROTOCOL    $server_protocol;
>
>
> fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
>  fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
>
>
>  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;
>
>  # PHP only, required if PHP was built with --enable-force-cgi-redirect
>
> fastcgi_param  REDIRECT_STATUS    200;
>
>
>
>
>
>
>
> On 4/23/08, Todd HG <lists at ruby-forum.com> wrote:
>  > I run Wordpress 2.5 under Apache 2.2 on a RedHat 5 ES server with no
>  > problems, and use Nginx to serve images, but I can't seem to get the
>  > right configuration to run Wordpress under Nginx. I have a script that
>  > runs the launches /usr/bin/spawn-fcgi on localhost IP 127.0.0.1 using
>  > port 8437, and running a process as php-cgi.
>  >
>  > Once I switch over Wordpress to Nginx I can view and interact with the
>  > Wordpress control panel, which means PHP is working fine, but I can't
>  > view the web site home page, or any articles. I get a grey blank page,
>  > not even a 404 error. I am unable to figure this out without help. My
>  > configuration is below.
>  >
>  >    server {
>  >        listen       my-ip-address:80;
>  >        server_name  www.mydomain.com mydomain.com;
>  >
>  >        location / {
>  >        root    /var/www/mydomain;
>  >        index  index.php index.html index.htm;
>  >
>  >        if (!-e $request_filename) {
>  >            rewrite ^(.+)$ /index.php?q=$1 last;
>  >         }
>  >        error_page  404              http://www.mydomain.com/e404.php;
>  >    }
>  >
>  > location ~ \.php$ {
>  >     fastcgi_pass  127.0.0.1:8437;
>  >     fastcgi_index index.php;
>  >     fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
>  >     fastcgi_param  SERVER_SOFTWARE    nginx;
>  >     fastcgi_param  QUERY_STRING       $query_string;
>  >     fastcgi_param  REQUEST_METHOD     $request_method;
>  >     fastcgi_param  CONTENT_TYPE       $content_type;
>  >     fastcgi_param  CONTENT_LENGTH     $content_length;
>  >     fastcgi_param  SCRIPT_FILENAME
>  > /var/www/mydomain$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  SERVER_PROTOCOL    $server_protocol;
>  >     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  REDIRECT_STATUS    200;
>  >     }
>  > --
>  > Posted via http://www.ruby-forum.com/.
>  >
>  >
>
>





More information about the nginx mailing list