Koozali.org: home of the SME Server

Help badly needed with Wordpress / SymLinks

Offline calisun

  • *
  • 601
  • +0/-0
Help badly needed with Wordpress / SymLinks
« on: June 21, 2011, 02:13:37 AM »
I had the same issue with SME 7.x, but the platform I am testing on right now is 8b6.

My setup:
First I issue following command:

Code: [Select]
db accounts setprop "iBay" AllowOverride all
db accounts setprop "iBay" FollowSymLinks enabled
signal-event ibay-modify "iBay"
yes, I change "iBay" to the name of my iBay

Than I create PHP temp directory, as instructed in bug:
http://bugs.contribs.org/show_bug.cgi?id=6650

next I install Wordpress in a iBay (no issues)

After installation, I create .htaccess file as instructed by wordpress.
(I know that there is a way to do the same thing with templates. But this way is quicker and there is no security issue since I am the only person that has access to this server and .htaccess  is not used for security control, it is used for SymLinks only)

here is what .htaccess contains:
Code: [Select]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

The Issue:

Everything seems to work OK, until I start to upload pictures/ files using wordpress.
It looks like the uploads work, I can see the files uploaded in correct folders, but the pictures don't show up in the blogs, I just get Broken picture icon. When I, right click, and "view the picture" I get a message that the picture does not exist on this server.
But I know that the upload works because when I go to: /ibays/wordpress/html/wp-content/blogs.dir/3/files/2011/06 I see the files in there.

Possible reasons:

I had a discussion on wordpress forums about this, and I was told that:

Quote
"htaccess file is not being read by the server"

Possible Solution:

I have found a discussion here that solved similar issue:
http://forums.contribs.org/index.php?topic=38139.0

The issue is:
The fragment he changed, does not exist in my .htaccess file. His solution was four years ago, maybe wordpress changed things in that time.

Also, his solution was to point to a specific domain, but I am using wordpress Multisite, so I have several domains pointing to one wordpress installation (No Issues)

Question

How can I find out if the command given at the beginning, does actually work, or indeed 8b6 is not reading .htaccess .
Was anybody able to get this working?

Please help as I have exhausted my limited programming skills.
 
I would really appreciate any help to solve this, and I thank everyone in advance for any help.
« Last Edit: June 24, 2011, 06:50:04 AM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline piran

  • ****
  • 502
  • +0/-0
Re: Help badly needed with SymLinks
« Reply #1 on: June 21, 2011, 04:02:29 AM »
Can't help with SymLinks but... to 'prove' that .htaccess
is being read try putting in an appropriate Rule for which
you can both predict and monitor the result... As for the
'missing' pictures apparently not on the server, check you
are not falling foul of max picture size (ie in PHP).

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Help badly needed with SymLinks
« Reply #2 on: June 21, 2011, 07:09:56 AM »
You should also check the access_log and error_log in /var/log/httpd/ it should give you clues as to what might not be working.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with SymLinks
« Reply #3 on: June 23, 2011, 10:38:09 PM »
.... check you are not falling foul of max picture size (ie in PHP).

A while back I had issues with large webmail attachments, so I increased the allowed file size in PHP to 99MB. And I see the message in webmail and wordpress, they both say "Allowed file size is 99MB".
Besides, I am only trying to attach a picture that is 500kb.

You should also check the access_log and error_log in /var/log/httpd/ it should give you clues as to what might not be working.

I don't see anything unusual in access_log, but looking at the error_log, I see this:

Code: [Select]
[Thu Jun 23 12:59:40 2011] [error] [client 192.168.10.243] File does not exist: /home/e-smith/files/ibays/wordpress/files/2011, referer: http://mydomain#3.org/
[Thu Jun 23 12:59:40 2011] [error] [client 192.168.10.243] File does not exist: /home/e-smith/files/ibays/wordpress/files/2011, referer: http://mydomain#3.org/

The list is longer than that, but it just repeats, so I only included couple of lines.

The interesting thing in the error_log, I see is this.
I am not sure what is causing this and if that is the issue, but here it is:

Code: [Select]
[Wed Jun 22 20:58:58 2011] [warn] Init: SSL server IP/port conflict: mydomain#2.org:443 (/etc/httpd/conf/httpd.conf:1345) vs. mydomain#3.org:443 (/etc/httpd/conf/httpd.conf:1473)
[Wed Jun 22 20:58:58 2011] [warn] Init: SSL server IP/port conflict: mydomain#4.org:443 (/etc/httpd/conf/httpd.conf:1217) vs. mydomain#3.org:443 (/etc/httpd/conf/httpd.conf:1473)
[Wed Jun 22 20:58:58 2011] [warn] Init: SSL server IP/port conflict: 192.168.10.1:443 (/etc/httpd/conf/httpd.conf:1089) vs. mydomain#3.org:443 (/etc/httpd/conf/httpd.conf:1473)
[Wed Jun 22 20:58:58 2011] [warn] Init: SSL server IP/port conflict: mydomain#1.org:443 (/etc/httpd/conf/httpd.conf:775) vs. mydomain#3.org:443 (/etc/httpd/conf/httpd.conf:1473)
[Wed Jun 22 20:58:58 2011] [warn] Init: You should not use name-based virtual hosts in conjunction with SSL!!
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline piran

  • ****
  • 502
  • +0/-0
Re: Help badly needed with SymLinks
« Reply #4 on: June 24, 2011, 01:05:10 AM »
Oh... certs. That could get heavy,
try it without using https ie a cert.

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with SymLinks
« Reply #5 on: June 24, 2011, 02:19:29 AM »
I am connecting to all my sites using  http
Only time I use https, is when I connect to webmail or server-manager.

But if it is just throwing an error message, without it causing my issues, I am not worried about it right now. I really need to fix the wordpress image issue.

ALSO,
to further test, besides the code shown earlier:

Code: [Select]
db accounts setprop "iBay" AllowOverride all
db accounts setprop "iBay" FollowSymLinks enabled
signal-event ibay-modify "iBay"

I have created a template of 90e-smithAccess40ibays in my custom path and I enabled allowoveride and FollowSymLinks in there.

Still nothing.  I don't know what else to try.
« Last Edit: June 24, 2011, 02:38:40 AM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline piran

  • ****
  • 502
  • +0/-0
Re: Help badly needed with SymLinks
« Reply #6 on: June 24, 2011, 03:17:17 AM »
Try a really BIG file.
Make your system work hard and long so that you
have time to monitor your system to determine
where it goes or even where it ends up.
Helpful tools :: slocate :: find :: htop

ClamAV file checking 'might be' blocking your file pattern.
If ClamAV is set to check everything then you should
check for its own file size limits too.

Spam assassin (?) similarly though I've never used it.

Just increasing PHP max is not always enough, the PHP
processing time limit interacts ...if you get my drift. 

It's a very long time ago that I dropped using WP
for good but I vaguely remember there might be
a file size limit or few in wordpress as well and
possibly some file type default exclusions.
I could be wrong though it was LONG ago.
« Last Edit: June 24, 2011, 03:29:10 AM by piran »

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #7 on: June 24, 2011, 06:58:07 AM »
Sorry, I have been replying on forums here and wordpress forums, so I forgot to include a detail here that I have included at wordpress forum. (I have also updated my first post with the info)

Quote
I know that the upload works because when I go to: /ibays/wordpress/html/wp-content/blogs.dir/3/files/2011/06 I see the files in there.

So the file gets uploaded, but I keep getting server message that the file does not exist on the server.

So it looks like htaccess is not being read by the server.
Trying to enable AllowOverride and FollowSymLinks per iBay basis does not work, and enabling AllowOverride and FollowSymLinks globally in 90e-smithAccess40ibays does not work.

I also thought it might be a permissions issue, so to test I changed permission of folder /blogs.dir/ to 777, still nothing.

What else is there? What am I missing?
« Last Edit: June 24, 2011, 07:06:58 AM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline piran

  • ****
  • 502
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #8 on: June 24, 2011, 12:38:57 PM »
So wp still does that even after all this time.
I dropped wp a very very long time ago.
That missing picture thing was happening back
then too... I can't remember a specific/generic
resolution and/or workaround - mists of time
and a declining grey cell count - sorry. Even
back then it nearly always turned out to be
permissions thing... wp needs/expects every
thing everywhere to be www available. If
push came to shove I would say it's a wp
thing and nothing to do with SME other
than, say, the right attributes necessary.
Best of luck ...signing off.

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #9 on: June 24, 2011, 03:19:23 PM »
I find that with web apps installed in ibays, I need to periodically correct file ownerships (usually after doing anything in the ibays panel in server-manager).
Code: [Select]
cd /home/e-smith/files/ibays/wordpress
chown -R www:www *

It's not clear to me what you're doing with SymLinks - my understanding of FollowSymLinks is that it allows your web server to serve files contained in symbolic links in the file system of the web server - that is, if your wordpress data is on an external drive at /mnt/mydata, you can have wordpress in an ibay but store your wordpress data in /mnt/mydata by creating a symlink between /home/e-smith/files/ibays/wordpress/html/wp-content and /mnt/mydata.  If you have done something like this, the file system type on the mounted device may be relevant (I don't know).

If you are using symlinks as I understand them, then to correct ownership or set access rights, you also have to tell chown or chmod to traverse symlinks:
Code: [Select]
cd /home/e-smith/files/ibays/wordpress
chown -R -L www:www *

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #10 on: June 24, 2011, 07:52:56 PM »
.....  It's not clear to me what you're doing with SymLinks ....

It is not what I am doing with symlinks, it is what wordpress is doing with them.
Wordpress uses symplinks in this way,
files are located in:

Code: [Select]
/ibays/wordpress/html/wp-content/blogs.dir/3/files/2011/06/picture.jpg
But in the browser it shows up as:
Code: [Select]
mydomain.org/files/2011/06/picture.jpg
The whole rule is in the htaccess file.

So the issue is, why is SME not reading the rule from htaccess?
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #11 on: June 24, 2011, 09:58:53 PM »
So the issue is, why is SME not reading the rule from htaccess?

You are jumping to a conclusion. Are you sure that it is correct?

Quote
File does not exist: /home/e-smith/files/ibays/wordpress/files/2011

Perhaps you are seeing that because of this in your httpd.conf:

Alias       /wordpress/files   /home/e-smith/files/ibays/wordpress/files

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #12 on: June 25, 2011, 09:15:18 PM »
Charlie, you are correct, in
/etc/httpd/conf/httpd.conf

I see what you have specified, and I see this repeated for every virtual domain.

This might work for single wordpress install since it places its files in:

/ibays/wordpress/html/wp-content/files/

But Multisite wordpress install uses:
/ibays/wordpress/html/wp-content/blogs.dir/3/files/

It has additional  /blogs.dir/#/   # represents a virtual domain, each domain get separate directory.

On Monday I will create a custom template of httpd.conf to be:
Alias       /wordpress/files   /home/e-smith/files/ibays/wordpress/blogs.dir/3/files
to see if I can get it to work.

Question is, what is it inputing wrong information into httpd.conf, is it wordpress or SME?
Also, how can this be fixed, because every time I add a domain, it will be wrong again.
« Last Edit: June 26, 2011, 07:37:01 AM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #13 on: June 26, 2011, 11:41:28 PM »
Charlie, according to the people on wordpress forum, that is how it is supposed to work (to shorten URL and for security reasons)

In the web browser one sees shortened URL, but htaccess is supposed to tell (redirect) web server where the actual file is at.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline calisun

  • *
  • 601
  • +0/-0
Re: Help badly needed with Wordpress / SymLinks
« Reply #14 on: June 29, 2011, 05:40:24 AM »
SUCCESS !!

After several test, I got it to work.

I have documented how I got it to work, and from it I have created a Step-by-Step instructions.
I will share my Step-by-Step with the community here on the WIKI, so people will not have same issues in the future.

It can be found here:
http://wiki.contribs.org/User_talk:Calisun
« Last Edit: June 29, 2011, 07:50:51 AM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite