Categories
Server Administration

xcache Revisited

In an earlier post, I complained about xcache 1.2.1 doing nothing but bad things to my server. I ended up moving to eAccelerator for a while instead. Recently, I moved to some better hardware to handle my ever-increasing traffic, and decided to give xcache another try. Low and behold 1.2.2 is out (and has been for a while it seems).

With the aid of a few plugins, I now have over 500 var caches running in xcache along with many php scripts themselves in the cache. My loads are WAY down (but, most of that can be contributed to the better hard ware) and page load times is MUCH faster.

I like it. And i retract my previous statements about it. Well done.

Categories
Programming Server Administration

WordPress Permalinks on IIS with ISAPI_Rewrite

I’ve run WordPress here on my CentOS box for nearly 4 years and am quite familiar with the software. Recently, I had a client on a Windows system request a blog be added to their web store. Their webstore is written in ASP and runs on windows. They wanted to stay on the same domain for SEO purposes, (thus site.com/blog/ instead of blog.site.com or a new .com). Without the subdomain or new IP, there’s no way to change DNS for a subdirectory to a different server. This meant I had to get it working on IIS.

Native installations for apache tend not to port well (or perhaps, easily) over to windows/IIS. Thankfully, ISAPI3 from HeliconTech.com supports .htaccess files and makes the job a little easier. WordPress works fine on windows/IIS until you want nice permalinks.

After MUCH searching, testing, and error log analysis, I’ve got a working solution for Windows Server 2003 with ISAPI_Rewrite 3.1.x, running php 5.2.x and mysql 5.0.x community.

  1. index.php should be set up in IIS as a default document (same place you find default.asp, index.htm, etc)
  2. edit wp-settings.php
    Find:


    at the very top of the file.

    Replace with:

  3. create the following htaccess file with the Helicon Manager:

    RewriteEngine On

    #RewriteBase /

    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 . /blog/index.php [L]

    • Note: You may need to alter the RewriteBase or the last rule to your specific location. In my particular case, I was installed on domain.com/blog/

From here, you can edit your permalink structure as you normally would. If the default options has index.php/ as part of the rule, you can remove that.

Categories
Server Administration

Getting the Big “Oops” from a Server

I had some minor problems with xCache recently that ended up causing segfaults in my apache install. I had left my SSH putty session open last night and didn’t check my laptop before I trecked into the office this morning (yes, some of us bloggers still have 9-5’s). When I got to work, I noticed my server was down. I had to hard reboot it through the IPMI switch at my data center. I removed xCache from my php.ini and things have been solid since.

I came home from work and looked at my putty session and got a good laugh. “Oops” it tells me. haha. I had a good chuckle about it.

Oops

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: Oops: 0002 [#1]

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: SMP

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: CPU: 1

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: EIP is at kernel_thread_helper+0x7/0x10

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: eax: 00000000 ebx: c0434cd9 ecx: ffffffff edx: ffffffff

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: esi: 00000000 edi: 00000000 ebp: 00000000 esp: e8121fe8

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: ds: 007b es: 007b ss: 0068

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: Process pdflush (pid: 8071, ti=e8121000 task=f67d3000 task.ti=e8121 000)

Message from syslogd@sv03 at Wed Nov 14 04:56:13 2007 …
sv03 kernel: Stack: c2858f60 00000000 00000000 00000000 00000000 00000000

Message from syslogd@sv03 at Wed Nov 14 04:56:14 2007 …
sv03 kernel: Call Trace:

Categories
Server Administration

xCache is More Trouble than it’s Worth

Two servers and a just about every option variation later, I’ve officially given up on xCache.

The first round of problems involved caching config files and forms that needed to be updated all the time. I made exclude rules for those, and eventually it just got too long and became way too tedious to restart apache every time i changed a config file.

Second round of problems involved Apache segfaults. Happened to me twice in 12 hours and cost me a good amount of money as it happened at 5am the second time, and I didn’t log in to check my server until noon (because I was sleeping). 7 hours of downtime across multiple sites that my server hosts, and I’m out some cash because of it, and missed out on some traffic due to a digg’ed post that is currently about to break from upcoming into popular.

I’ve disabled xcache for now, and things seem to be stable again.

Running it, it saved me about .2 average load, and memory usage was about the same at 25% most the time.

I can’t say the site ran faster with it on either.

Maybe i’ll try it again in a later version, but in my opinion, version 1.2.1 is not all it’s cracked up to be.

Categories
Server Administration

Restart Windows via Remote Desktop

Ever try to restart a machine via remote desktop? I just ran into it for the first time tonight. I generally deal with linux servers and don’t ever RDP into them. Tonight, I needed to reboot a windows server. No “shutdown” exists on the Start menu. Even on the task manager, there’s no shutdown option.

It’s an easy bypass though.

Instead of CTRL+ALT+DEL like usual, use

CTRL+ALT+END

From here, you will be able to shut down or graceful reboot the system.

Categories
Server Administration

How to View Apache error logs

If you’re new to running your own server, sometimes just finding things is the hardest thing to do. I spent a good 15 min trying to find mine, so here’s some info to help you.

Your system may vary. All my postings are from CentOS 5, running php 5.2.x, mysql 5.0.2x, and apache 2.2.x

You may need root-level access to see some of these as well.

I use pico. Some people like VI, some like VIM, some like NANO. I use pico. It’s just a text viewer.

View apache error_log

pico /usr/local/apache/logs/error_log

Send the text file to your website to make it viewable

cp /usr/local/apache/logs/error_log /home/SITEPATH/public_html

You can then view it in http://site.com/error_log. Firefox will open it up with out a download prompt.

Categories
Server Administration

Avoid the Mail Blackhole

I started running out of space on my /home volume recently, so i started looking around for random files and old crap i could delete to buy myself some more time before hardware upgrades.

The log files were an obvious first stop. I still had a ton of space i needed to find where it was being used. My file system showed only a couple gigs and my database was only a couple more, yet I was approaching on 20GB of used space. Where was the rest of it?

Turns out, it was all spam and bounces from registration emails, etc from my forums.

cPanel sets up the default catch-all to go to the accountname@domain.com. ie, if you named your site mysite01, cPanel defaults itself to forward all un- pop3’ed addresses to this account.

IMAP is the only way to get into it (easily), so i opened up Horde and nearly spit my beverage on my monitor. One account had 145,000 odd emails in there, and 4 others had over 50,000 emails in there. My not so popular domains still had a couple thousand in them from just years of collecting viagra and stock quote spams.

I easily recovered 10% of my /home volume just by deleting spam and bounce emails.

The easy way to fix this is to go into WHM’s Tweak Settings at the top, and change the default on New Accounts to :fail: instead of :blackhole:. Unfortunately, this is NOT retro-active, so you will need to go into each of your accounts sub-cpanels and change the catch-all in there from :blackhole: (or “forward to” if you have the new cPanel template) and set it to :fail: (if you have the new template, select the radio button that says “discard with error at SMTP…”).

Lesson Learned. the Blackhole is a bad thing, and the default forwarder is even worse.

10% is a lot of space, especially when you consider most emails are in the 2-3Kb range.

So, if you’re running out of space, and you’re a novice dedicated server admin like myself, check your mail settings. You might be surprised too.