• Okay. I have the same problem as at https://www.ads-software.com/support/topic/i-give-up-6. As requested I’ve made my own topic for this (sorry for not doing that)

    I have Ubuntu 11.04 with Apache 2, PHP5 and MySQL 5.1 all nicely talking to each other on a very clean install (put together last night). I run a Multi-site configuration with subdomains (they load fine)

    I too have permalinks working (domain.com/2011/12/post-title), but most, if not all images refuse to load.

    i.e.
    https://www.domain.com/wp-content/uploads/2011/06/couple.jpg gives a *wordpress* 404.

    I’ll post my Apache configuration as I know it’s a configuration issue that I don’t understand where things are wrong. As far as I understand, below is the order in which Apache processes files. Changes I’ve made are noted, and where I’ve altered something, I’ve pasted the entire config file and noted what was changed in the hopes that solving this will help others. I’d appreciate if someone with a working multisite configuration could give this a quick look over and check what I’ve done:

    /etc/apache2/apache2.conf [NO changes]
    /etc/apache2/httpd.conf [BLANK]

    /etc/apache2/mods-enabled/*.load [Enabled rewrite using a2enmod]
    /etc/apache2/mods-enabled/*.conf [NO changes]

    /etc/apache2/ports.conf [NO changes]

    /etc/apache2/conf.d/* [NO changes]

    /etc/apache2/sites-enabled [Changes below]

    1. I copied the 000-default in /etc/apache2/sites-available to mysite.com
    2. I added a symlink in /etc/apache2/sites-enabled/mysite.com to /etc/apache2/sites-available/mysite.com
    3. I removed the symlink for 000-default
    4. I altered the configuration of mysite.com as below. I removed the /cgi-bin and /docs directives as don’t use them to try to simplify things. I also commented out <Directory /> but don’t know if that’s a problem
    <VirtualHost *:80>
    	<strong>ServerAdmin [email protected]
    	ServerName mysite.com
    	ServerAlias *.mysite.com</strong>
    
    	# AMediaCompany: Altered this line below
    	DocumentRoot /var/www/mysite
    #	<Directory />
    #		Options FollowSymLinks
    #		AllowOverride None
    #	</Directory>
    
    	# AMediaCompany: Altered this line below
    	<Directory /var/www/mysite>
                    AllowOverride All
    
    		Order allow,deny
    		allow from all
    	</Directory>
    
    	ErrorLog ${APACHE_LOG_DIR}/error.log
    
    	# Possible values include: debug, info, notice, warn, error, crit,
    	# alert, emerg.
    	LogLevel warn
    
    	CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>

    I added my .htaccess as per the norm:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    Options +FollowSymLinks
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    What I know is this. If I alter mysite.conf to have ‘AllowOverride none‘, the images load fine, but the permalinks don’t work (as expected)

    If I set ‘AllowOverride FileInfo‘ I get an internal server error (nothing in Apache logs other than the access log of saying it was an http status code of ‘500’)
    Ditto if set only ‘AllowOverride Options

    So, to me it seems like a server issue and Apache’s thinking files are not found under certain conditions because the 404 gets passed over to wordpress

    Edit: clarity (no preview option sometimes makes a large post difficult)
    Edit2: can’t bold inside a code tag; added comments which are not in place normally

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter AMediaCompany

    (@amediacompany)

    Okay, I’ve figured out what is causing the problem, but I’m not sure I know how to completely setup the site.

    whenever I re-set the permalinks, wordpress writes a new .htaccess and .htpasswd file to /wp-content/uploads/

    This gives me:

    /wp-content/uploads/.htaccess
    /wp-content/uploads/.htpasswd

    Since all the urls in my main blog are linked to
    https://mysite.com/wp-content/uploads/... these .htaccess files stop my main site from accessing files.

    Given the .htaccess is looking for /files/ before redirecting them, do I need to change all the references in my posts to support multisites?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    WordPress shouldn’t be writing an .htaccess ANYWHERE except in /

    What the hell?

    What plugins are you running?

    Thread Starter AMediaCompany

    (@amediacompany)

    Lots. Bear with me on this one. I may have to take time to answer as the project was literally due yesterday. It’s probably a plugin, but it cost me loads of time figuring this one out.

    It’s a site I inherited rather than setup myself, so don’t know the ins and outs of what, why and wherefore

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I feel your pain ??

    Check for any plugins that have to do with hotlinking or images.

    Thread Starter AMediaCompany

    (@amediacompany)

    I’ve had a little time to look into this and it appears that it’s to do with the user access manager I installed. The code of the htaccess file leads me to this conclusion; I was way too tired to notice this before Christmas. I’m posting the htaccess code here in case someone finds it and searches for it. hopefully they’ll find this thread:

    User access manager available at:
    https://www.gm-alex.de/projects/wordpress/plugins/user-access-manager/, version 1.2.1

    /wp-content/uploads/.htaccess

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteRule (.*) /index.php?uamfiletype=attachment&uamgetfile=$1 [L]
    </IfModule>

    There is a configuration option in the settings to ‘lock files’, which I had *disabled*, so something may be wrong. However, when I now try to update the permalink settings, nothing appears to ‘go wrong’. As I don’t want this to go wrong again, I’ve set up an .htaccess file that is completely blank, read only (chmod 0444), and not owned by the web server user so the wordpress plugin won’t be able to write there, even if it wants to

    Any of the above htaccess fixes should prevent the problem from reoccurring, but I’ve implemented all to make sure. I’ve contacted the author of the plugin to ask him to check if he’s assuming default settings wrongly.

    Once the settings are saved, the plugin seems to behave as expected

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Server Config for Multisites’ is closed to new replies.