The MU forums have moved to WordPress.org

Wordpress MU on nginx @ slicehost- Close but no cigar (7 posts)

  1. jhh2006
    Member
    Posted 15 years ago #

    I got all the way through my slice setup using the excellent tutorials coupled with this blog post:

    Perfect Setup: Ubuntu Hardy+Nginx+MySQL5+PHP5+Wordress
    http://www.mensk.com/webmaster-toolbox/perfect-ubuntu-hardy-nginx-mysql5-php5-wordpress/

    I got Wordpress MU to install successfully as well, but now when I try to login as admin, I get a loop that brings me back to the login box.

    And I haven't even started trying to figure out the pretty urls and wildcard domain stuff. Can you help me?

    server {

    listen 80;
    server_name MYSITE.com;
    rewrite ^/(.*) http://www.MYSITE.com/$1 permanent;

    }

    server {

    listen 80;
    server_name http://www.MYSITE.com;

    access_log /home/public_html/MYSITE.com/log/access.log;
    error_log /home/public_html/MYSITE.com/log/error.log;

    location / {

    root /home/public_html/MYSITE.com/public/;
    index index.php index.html;

    # Basic version of Wordpress parameters, supporting nice permalinks.
    # include /usr/local/nginx/conf/wordpress_params.regular;
    # Advanced version of Wordpress parameters supporting nice permalinks and WP Super Cache plugin
    # include /usr/local/nginx/conf/wordpress_params.super_cache;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include /usr/local/nginx/conf/fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /home/public_html/MYSITE.com/public/$fastcgi_script_name;
    }
    }

  2. jhh2006
    Member
    Posted 15 years ago #

    I also tried a number of variations on

    server {

    listen 80;
    server_name MYSITE.com *.MYSITE.com;

    location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$

    {

    root /home/public_html/MYSITE.com/public/;

    rewrite ^/.*(/wp-admin/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
    rewrite ^/.*(/wp-includes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
    rewrite ^/.*(/wp-content/themes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
    rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wp-content/blogs.php?file=$1 last;
    expires 10d;
    break;
    }

    location / {

    root /home/public_html/MYSITE.com/public/;
    index index.html index.htm index.php;

    if (!-e $request_filename) {
    rewrite ^.+?(/wp-.*) $1 last;
    rewrite ^.+?(/.*\.php)$ $1 last;
    }

    # if ($http_cookie !~* "comment_author_|wordpress|wp-postpass_" ) {
    # rewrite ^(.*)$ /wp-content/cache/supercache/$http_host/$1index.html;
    # break;
    # }

    error_page 404 = @tricky;
    }

    location ~ \.php$ {

    rewrite ^ /index.php last;
    rewrite ^/.*(/wp-login.php)$ $1;
    rewrite ^/.*(/wp-admin/.*\.php)$ $1;
    rewrite ^/.*(/wp-includes/.*\.php)$ $1;

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /home/public_html/MYSITE.com/public/$fastcgi_script_name;
    include /usr/local/nginx/conf/fastcgi_params;
    }

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

    server {

    server_name http://www.MYSITE.com;
    rewrite ^/(.*) http://MYSITE.com/$1 permanent;

    }

  3. jhh2006
    Member
    Posted 15 years ago #

    Solved everything except the wildcard. Hope this will help someone in the future:

    server {

    listen 80;
    charset utf-8;

    server_name MYSITE.com;
    index index.php;
    root /home/public_html/MYSITE.com/public/;

    access_log /home/public_html/MYSITE.com/log/access.log;
    error_log /home/public_html/MYSITE.com/log/error.log;

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

    # rewrite rule - fancy urls for wordpress mu

    rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;

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

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include /usr/local/nginx/conf/fastcgi_params;
    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 SCRIPT_FILENAME /home/public_html/MYSITE.com/public/$fastcgi_script_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;
    }
    }

  4. honewatson
    Member
    Posted 15 years ago #

    Please refer to this thread for better results:

    http://mu.wordpress.org/forums/topic.php?id=3410

  5. jhh2006
    Member
    Posted 15 years ago #

    I read that thread a million times. It's waht got me to an answer an yet I remain confused.

  6. honewatson
    Member
    Posted 15 years ago #

    The problem with the above configuration that you pasted is:

    1. It is not optimal for a basic setup
    2. It will not work with super cache.

    You do not need this:

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

    According to Igor, the main programmer of Nginx, it's better to replace the above with just one line:

    error_page       404 = /index.php?q=$uri;
  7. tdjcbe
    Member
    Posted 15 years ago #

    I saw this post and just wanted to post a link to it as the author included a bit at the end on wp:

    http://roopindersingh.com/2008/12/16/moving-over-to-nginx/

About this Topic