Forums

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

Create a New Blog - get a 404 page (11 posts)

  1. avjazelur
    Member
    Posted 2 years ago #

    Hi there -

    I've setup a very vanilla installation of wordpress_mu.

    I've taken the sub-folder approach.

    My "root" blog (the default created by the installation process) is displaying just fine at http://mydomain.com/.

    However, when I try to create a new blog at http://mydomain.com/mynewblog - the browser cannot find it.

    I have apache mod_rewrite enabled:

    root@domU-12-31-39-06-8D-81:~# ls -l /etc/apache2/mods-enabled/
    lrwxrwxrwx 1 root root 27 2009-09-29 17:29 php5.conf -> ../mods-available/php5.conf
    lrwxrwxrwx 1 root root 27 2009-09-29 17:29 php5.load -> ../mods-available/php5.load
    lrwxrwxrwx 1 root root 30 2009-09-29 17:49 rewrite.load -> ../mods-available/rewrite.load
    lrwxrwxrwx 1 root root 31 2009-09-29 17:29 setenvif.conf -> ../mods-available/setenvif.conf
    lrwxrwxrwx 1 root root 31 2009-09-29 17:29 setenvif.load -> ../mods-available/setenvif.load
    lrwxrwxrwx 1 root root 29 2009-09-29 17:29 status.conf -> ../mods-available/status.conf
    lrwxrwxrwx 1 root root 29 2009-09-29 17:29 status.load -> ../mods-available/status.load

    (for brevity not all results shown)

    The contents of my .htaccess file are here.

    root@domU-12-31-39-06-8D-81:~# cat /var/www/.htaccess
    RewriteEngine On
    RewriteBase /
    
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    </IfModule>

    Does anyone have any ideas? I haven't changed the default apache config at all - apart from enabling mod_rewrite.

    Thanks -

  2. andrea_r
    Moderator
    Posted 2 years ago #

    "I haven't changed the default apache config at all"

    So it may not be actually *reading* the htaccess file. :)

    You need to AllowOverride FileInfo Options.

  3. avjazelur
    Member
    Posted 2 years ago #

    Thanks for the quick reply.

    I tried altering my /etc/apache2/apache2.conf file. It now contains the following:

    #
    # AccessFileName: The name of the file to look for in each directory
    # for additional configuration directives.  See also the AllowOverride
    # directive.
    #
    
    AccessFileName .htaccess
    
    #
    # The following lines prevent .htaccess and .htpasswd files from being
    # viewed by Web clients.
    #
    #<Files ~ "^\.ht">
    #    Order allow,deny
    #    Deny from all
    #</Files>
    
    <Directory /var/www/>
       AllowOverride Options FileInfo
    </Directory>

    But still 404s at http://mydomain/mynewblog/

    The .htaccess file is present in the /var/www/ directory.

    root@domU-12-31-39-06-8D-81:~# ls -la /var/www/.htaccess
    -rw-r--r-- 1 www-data www-data 651 2009-09-30 00:48 /var/www/.htaccess

    and the owner of the file (www-data) is the same owner as the apache process:

    root@domU-12-31-39-06-8D-81:~# ps -ef | grep apache2
    root     13612     1  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13616 13612  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13617 13612  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13618 13612  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13619 13612  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13620 13612  0 21:05 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13621 13612  0 21:06 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13622 13612  0 21:06 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13623 13612  0 21:06 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data 13624 13612  0 21:06 ?        00:00:00 /usr/sbin/apache2 -k start
    root     14061 14018  0 22:54 pts/0    00:00:00 grep apache2

    So I'm guessing I've mucked up the config file for apache. Can you give me anymore clues?

    Thanks -

  4. avjazelur
    Member
    Posted 2 years ago #

    Managed to figure this one out...

    With Ubuntu, the apache configuration files are spread over a number of directories. The file that must be changed is NOT /etc/apache2/apache2.conf, but /etc/apache2/sites-available/default. (Or at least it was in my case - if you're not using the default site it might be different).

    Look for a VirtualHost directive then change the "AllowOverride None" to "AllowOverride FileInfo Options" for the directory that the .htaccess file resides in.

    Hope that helps anyone who has the same problem as I did....

  5. andrea_r
    Moderator
    Posted 2 years ago #

    Yeah, different OS have different locations for that. Glad you found it & it worked. :)

  6. spammie
    Member
    Posted 1 year ago #

    hi people.

    i just ran into the same problem using wpmu 2.9.1 on fedora/nginx

    as i read in the posts in this forum it seems as if the database that would be created should be wp_$blogid_foo but the are not.

    i added *.mydomain.tld to the nginx.conf file and to the dns settings, still not working.

    @andrea_r:
    i remember reading somewhere that you host your projects using nginx as well. are there any special rewrite rules i should add? everything else is running smoothely (i at least havent found any problems till now)

    fyi the url would be http://www.greenandsocial.net -> soon will be a social network for green and socially comitted people all around the world. since i havent even setup the mail server till now you wont be able to register untill i found the time to mess with postfix and his friends :)

    thanks for the great work all of you contribute
    greetings
    spammie

  7. andrea_r
    Moderator
    Posted 1 year ago #

    Yeah, nginx needs its own rewrite rules. there's a couple really good threads here in the forum with them in it.

  8. spammie
    Member
    Posted 1 year ago #

    hi again.

    i already managed to get everything working EXCEPT creation of new blogs
    i just confirmed by trying every link on my page.

    i can post comments, post new blog posts, create pages and so on and so forth.

    i dare to post my nginx.conf here, hope you dont mind :)

    server {
            listen       80;
            server_name  greenandsocial.net http://www.greenandsocial.net *.greenandsocial.net;
          	#charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            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 /my/web/dir;
    	        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;
        	}
    
    	    location / {
    	        root /my/web/dir;
    	        index index.php;
    
    	        if (!-e $request_filename) {
    	            rewrite ^.+/?(/wp-.*) $1 last;
    	            rewrite ^.+/?(/.*\.php)$ $1 last;
    	            rewrite ^(.+)$ /index.php?q=$1 last;
    	        }
    	    }
    
            error_page  404              /404.html;
            location = /404.html {
                root   /my/web/dir;
            }
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   /my/web/dir;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                root           /my/web/dir;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /my/web/dir$fastcgi_script_name;
                include        fastcgi_params;
            }
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            location ~ /\.ht {
                deny  all;
            }
        }

    is *.greenandsocial.net in the server_name var enough to enable wildcards?
    in my dns settings i have enabled wildcards by pointing them to the same ip as the other urls i use.
    could the problem be caused by adding phpmyadmin.greenandsocial.net and mail.greenandsocial.net as well as wildcard dns ? (phpmyadmin and mail are subdomains and declared in their own server{} blocks.
    my questions:
    should i move all the settings for one domain into one server block?
    are the rewrite rules i use sofisticated enough?
    could it be that the missing email server is causing my problem?
    i guess the answer to the last question will only be able to get by fixing postfix, which is driving me mad atm :D
    guess i should have stuck to apache when i decided to set up my first self maintained server, but i just love that crazy, fast, lightweight, gorgeous nginx. :D

    thanks again,
    spammie

  9. spammie
    Member
    Posted 1 year ago #

    sorry for the doublepost. the http:// part of http://www.greenandsocial.net has been automatically appended, in my nginx.conf there only is www.* as mentioned in the docs and forum posts.

    greetings
    spammie

  10. spammie
    Member
    Posted 1 year ago #

    got some news again.

    i just deactivated buddypress, moved my nginx named subdomains above my wildcard subdomain and finally could create new blogs.
    once i reactivate buddypress i get the 404 again
    since i only need a few subblogs right now that is not a big deal, but since i will definitely want to create blogs in the future i will run into that problem again.
    guess i will have to file a bug report at the buddypress' homepage

    thanks for the help anyways,

    greetings
    spammie

    ps: the nginx config above is derived from the forumposts here and the nginx wiki. the rewrites seem to work flawlessly.

  11. andrea_r
    Moderator
    Posted 1 year ago #

    There's a bug in the latest BP with the blogs, but it's been fixed in trunk (I think)

Topic Closed

This topic has been closed to new replies.

About this Topic