Forums

The WordPress MU forums have moved to the MultiSite forum on WordPress.org

Nginx sub-directory after install problem (8 posts)

  1. ndrwld
    Member
    Posted 2 years ago #

    Hi there,
    I have confusing problem. There is a need to install WPMU with sub-directory on Nginx.
    *With my server configuration there is no problems with subdomain install. It works perfectly.

    After WPMU install with sub-directory option i get this error in nginx logs:

    2009/10/08 02:11:18 [error] 15837#0: *215 FastCGI sent in stderr: "WordPress database error Table 'devbase.wp_sfsd3_blogs' doesn't exist for query SELECT * FROM wp_sfsd3_blogs WHERE domain = 'dev.domain.com' made by require, include, include_once, require_once, require_once
    WordPress database error Table 'devbase.wp_sfsd3_sitemeta' doesn't exist for query SELECT meta_value FROM wp_sfsd3_sitemeta WHERE site_id = 1 AND meta_key = 'site_name' made by require, include, include_once, require_once, require_once, get_current_site_name
    WordPress database error Table 'devbase.wp_sfsd3_blogs' doesn't exist for query SELECT blog_id FROM wp_sfsd3_blogs LIMIT 0,1 made by require, include, include_once, require_once, require_once
    WordPress database error Table 'devbase.wp_sfsd3_sitemeta' doesn't exist for query SELECT meta_value FROM wp_sfsd3_sitemeta WHERE meta_key = 'wpmu_sitewide_plugins' AND site_id = 1 made by require, include, include_once, require_once, get_site_option" while reading upstream, client: 84.240.26.186, server: dev.domain.com, request: "POST /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "dev.domain.com", referrer: "http://dev.domain.com/"
    2009/10/08 02:11:40 [error] 15839#0: *226

    Here is my Nginx configuration:

    server
    {
    
    	listen			80;
    	server_name		dev.domain.com;
    
    	access_log 		/home/public_html/dev.domain.com/log/access.log;
    	error_log 		/home/public_html/dev.domain.com/log/error.log;
    
    # rewrite rule for files
    
    	location	~*	^.+\.(xml|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$
    	{
    		root		/home/public_html/dev.domain.com/public;
    		rewrite		^/files(/.*)$	/wp-content/blogs.php?file=$1	last;
    		expires		10d;
    		break;
    	}
    
    # rewrite rule for sitemap under the lines that handles upload files
    	rewrite ^(.*/)?sitemap.xml wp-content/sitemap.php;
    
    # rewrite errors
    	location	/
    	{
    		root		/home/public_html/dev.domain.com/public;
    		index		index.php;
    
            # WordPress pretty URLs: (as per dominiek.com)
    if (-f $request_filename) {
    break;
    }
    if (-d $request_filename) {
    break;
    }
    rewrite ^(.+)$ /index.php?q=$1 last;
    			error_page	404	= /index.php?q=$uri;
    			#My IP
    			allow xx.xxx.xx.xxx;
                            	deny all;
    	}
    
    #send php requests to fast cgi
    	location	~	\.php$
    	{
    		fastcgi_pass		127.0.0.1:9000;
    		fastcgi_index		index.php;
    		fastcgi_param		SCRIPT_FILENAME		/home/public_html/dev.domain.com/public$fastcgi_script_name;
    		include				/usr/local/nginx/conf/fastcgi_params;
    	}
    }

    Any ideas?

  2. ndrwld
    Member
    Posted 2 years ago #

    Ohh sorry, and the problem is that when clicking on Hello World post, the url is broken (404 error)
    2009/10/08 02:11:42 [error] 15839#0: *226 "/home/public_html/dev.domain.com/public/2009/10/08/hello-world/feed/index.php" is not found (2: No such file or directory)

  3. wpmuguru
    Member
    Posted 2 years ago #

  4. ndrwld
    Member
    Posted 2 years ago #

    Big thanks wpmuguru, i tried this before, but probably I've mismatch something, because now its working :)
    Here is new configuration

    server {
    
    	listen			80;
    	server_name		dev.domain.com;
    
    	access_log 		/home/public_html/dev.domain.com/log/access.log;
    	error_log 		/home/public_html/dev.domain.com/log/error.log;
    
    # rewrite rule for files
    
    	location	~*	^.+\.(xml|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$
    	{
    
    		root		/home/public_html/dev.domain.com/public;
    
    rewrite ^/.*(/wp-.*/.*\.(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 30d;
            break;
    	}
    
    # rewrite errors
    	location	/
    	{
    		root		/home/public_html/dev.domain.com/public;
    		index		index.php;
    
    rewrite ^.*/files/(.*) /wp-content/blogs.php?file=$1;
      if (!-e $request_filename)
    		{
       rewrite ^.+?(/wp-.*) $1 last;
       rewrite ^.+?(/.*\.php)$ $1 last;
       rewrite ^ /index.php last;
    		}
    
    # rewrite rule for sitemap under the lines that handles upload files
    	rewrite ^(.*/)?sitemap.xml wp-content/sitemap.php;
    
            # WordPress pretty URLs: (as per dominiek.com)
     if (-f $request_filename)
    {
     break;
     }
    if (-d $request_filename)
    {
     break;
    }
    rewrite ^(.+)$ /index.php?q=$1 last;
    			error_page	404	= /index.php?q=$uri;
    			#My IP
    			allow xx.xx.xx.xx;
    
                            	deny all;
    	}
    
    #send php requests to fast cgi
    	location	~	\.php$
    	{
    		fastcgi_pass		127.0.0.1:9000;
    		fastcgi_index		index.php;
    		fastcgi_param		SCRIPT_FILENAME		/home/public_html/dev.domain.com/public$fastcgi_script_name;
    		include				/usr/local/nginx/conf/fastcgi_params;
    	}
    }
  5. ndrwld
    Member
    Posted 2 years ago #

    The new installation still doesn't work properly.. (ver. 0.7.62)
    Maybe somebody could share working configuration for sub-directory installation?
    Big thanks

    I tried a lot of conf versions form other sources without any results...

  6. ndrwld
    Member
    Posted 2 years ago #

    Still fighting with this. Just have found out that the problem is in "/blog" entry in the link:

    "http://dev.domain.com/blog/2009/10/08/hello-world/" - Error 404
    "http://dev.domain.com/2009/10/08/hello-world/" - works Fine!
  7. ndrwld
    Member
    Posted 2 years ago #

    The funniest moment is that I have the same problem on local machine with apache on XAMPP! :D

  8. ndrwld
    Member
    Posted 2 years ago #

    The problem with apache was in "Options Indexes FollowSymLinks" option, which is required in <Directory> section on virtualhost. I created ticket in trac - http://trac.mu.wordpress.org/ticket/1129

    I'm still looking for solution in nginx rewrites.
    Once again the problem is in pretty permalink rewrites

    "http://dev.domain.com/blog/2009/10/08/hello-world/" - Error 404 - Not Found
    "http://dev.domain.com/2009/10/08/hello-world/" - works Fine!

    When i go to Settings/Permalinks and set it to "Default" everything works perfectly.
    Various rewrites versions doesn't work. I need somehow to insert /blog/ into rewrites...
    Please Help!

Topic Closed

This topic has been closed to new replies.

About this Topic