PHP APC Extension memory limit

Recently a website of my client is acting like crazy. Certain links are not working but Apache itself is working, the main website is also working.
Upon checking on the Apache logs, I've found messages like below.

-
[Fri Aug 16 10:21:00 2012] [apc-warning] Unable to allocate memory for pool. in /var/www/vhosts/DOMAIN.com/httpdocs/modules/mod_roknavmenu/helper.php on line 25.
[Fri Aug 16 10:21:00 2012] [apc-warning] Unable to allocate memory for pool. in /var/www/vhosts/DOMAIN.com/httpdocs/modules/mod_roknavmenu/helper.php on line 41.
-


It was because of memory limitation in APC extension of PHP.
To fix it, you need to increase the memory limit of APC. Edit the file - /etc/php.d/apc.ini
Look for apc.shm_size and increase its size.

Connect your Java App to Apache via mod_jk


If there's a need to connect a Tomcat App to Apache, so that the web application can be access directly via port 80 (instead of 8080), I always use mod_proxy_ajp as it's very easy to configure. By default it's loaded in Apache in CentOS, while in Ubuntu you still have to load manually that module.

For some reasons, mod_proxy_ajp keeps on failing. It's throwing an error message like below:

[Thu Jun 21 10:21:29 2012] [error] proxy: AJP: failed to make connection to backend: localhost
[Thu Jun 21 10:21:31 2012] [error] proxy: AJP: disabled connection for (localhost)
[Thu Jun 21 10:22:04 2012] [error] proxy: AJP: disabled connection for (localhost)
[Thu Jun 21 10:23:49 2012] [error] (111)Connection refused: proxy: AJP: attempt to connect to 127.0.0.1:8009 (localhost) failed


I just can't fix it. Weird!

So I have decided to switch to mod_jk. I have done this in Ubuntu server.

Assuming that you've already got Tomcat and Apache working in your box, to install mod_jk:
apt-get install libapache2-mod-jk

Create your workers.properties file:
vim /etc/apache2/workers.properties

Insert the following:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009



Configure Apache to use the worker that you have just created:
vim /etc/apache2/apache2.conf

Insert the following:
JkWorkersFile /etc/apache2/workers.properties
JkShmFile /var/log/apache2/mod_jk.shm
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "


Configure which site or URL is to be pass connected to Tomcat:
vim /etc/apache2/sites-enabled/000-default


For instance if you want to have the ROOT app from your Tomcat to be connected to Apache, insert this line:
JkMount / worker1

Enable connector port in Tomcat by uncommenting the following line in /etc/tomcat6/server.xml:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


Restart Apache and Tomcat, that's it!






 

CVE-2012-2122 | MySQL Vulnerability

I just did a quick upgrade on 3 servers as they were vulnerable to CVE-2012-2122.
1and1 wasn't quick to send out newsletter on this, just now I have received an email from Softlayer and Mediatemple. Oh well, unmanaged is unmanaged!

Plesk: Unable to create subdomain

Earlier today my client asked me to fix his Plesk, it can't create a subdomain.
Plesk only shows some generic error message from its interface. Upon checking the Plesk logs, I found this:

Skeleton directory `/var/www/vhosts/.skel/0' does not exist

Pretty simple, it means that /var/www/vhosts/.skel/0/ directory was deleted.
The work around is to simply recreate those directories. You may just copy the default Plesk files from any of your domain:

-bash-3.2# cp -a /var/www/vhosts/my-existing-domain.com/httpdocs/ /var/www/vhosts/.skel/0/httpdocs/
-bash-3.2# cp -a /var/www/vhosts/my-existing-domain.com/httpsdocs/ /var/www/vhosts/.skel/0/httpsdocs/
-bash-3.2# cp -a /var/www/vhosts/my-existing-domain/cgi-bin /var/www/vhosts/.skel/0/cgi-bin/
-bash-3.2# cp -a /var/www/vhosts/my-existing-domain/error_docs/ /var/www/vhosts/.skel/0/error_docs
/

If you'll attempt to create the subdomain now, I'm sure it will still fail.
Because even though it failed initially, Plesk still created the subdomain but without having those default files since they did not exist (from the .sked/0/ directory).

To remove the subdomain, issue the command below:

/usr/local/psa/admin/sbin/subdomainmng --remove --subdomain-name=testsubdomain --vhost-name=yourdomain.com

Go back to Plesk. You should be able to create the subdomain now.

Wanna burst up to 300mbps? Try 1and1

I've said this before, 1and1's network is superb! I'm not sure what's the pool of bandwidth that they got, but what I got is more than enough. They have peerings with providers like Lycos, Yahoo!, Trustnet and many more. Their network exceeds my expectation.

For the past 4-5 days, one Linux box that I'm handling has been very busy. I'm also keeping an eye on it, I'm afraid that it may break anytime or maybe some services will just stop as it has been very busy lately. The Linux server works as HTTP server, the DB server is also on a Linux platform but it's not fully unitilized. Let's call this HTTP server as 'redmate' - that's actually the hostname assigned (redmate.internal) to the server. =)

redmate has been fully utilized for the past few days.
  • Memory usage is hitting up to 90%
  • Load average is around 20. It's a dual quad-core box.
  • Some spikes on Disk I/O have been noticed too.

But what surprises me is the bandwidth usage. It's hitting up to 300 megabit, I thought it can only burst up to 100 mbps? Well not really.

Kansas vs Kentucky - resulting to 200mbps burst of bandwidth

Today is NCAA Men's Basketball finals, it's Kansas Jayhawks vs Kentucky Wildcats.
One of the server that I'm handling is hosting a webzine for NCAA Men's Basketball. Though it has no video streaming feature of the current match, the site is bursting up to 200mpbs of bandwidth for the past hour.

Wow! I thought 1and1 is shaping the bandwidth for dedicated servers to burst only up to 100mbps?
Does this mean that we can burst up to 1gbps? We'll never know unless we'll experience it, so I might do some stress testing within this month.

Okay, let me go back to the game. It's 2nd quarter now.

1and1's Managed Server sucks!

Why I said so? Because you're not given with a root access on the server.
There are many providers out there that focus on managed service, yet they give the customer with a root access. I mean, you are leasing the server from them. You're the one who's paying it monthly or so, then why can't you access fully? Why are you given with a limited user account?

Uhm, or maybe the customer is not given with root access because they are not using a physical server for it? Perhaps they're using a VM like Xen for that? Whatever!

A true managed service must offer the following:
  • root access for the customer
  • monitoring of the server (I know this is common, they have this)
  • monitoring of the services on the server
  • monitoring of the server's hardware resources
  • bandwidth monitoring and graphing
  • disk IO monitoring and graphing
  • mysql monitoring and graphing
  • httpd monitoring and graphing
  • regular security audit
  • vulnerability assessment
  • DDOS protection
  • highly designed firewall
  • and of course, great technical support!
The only thing that's there with the Managed Server of 1and1 is the monitoring of the server.
If you're looking for a Managed Server, there's Rackspace (expensive? sure they are), Liquid Web, Softlayer,Layered Tech and some smaller players like WebNX, Quadra Net and many others.

I would say avoid 1and1's Managed Server.

Windows Server: I want to have MS SQL, do I need to purchase Plesk Power Pack?

As you have know, Windows Dedicated Server from 1and1 comes with Plesk Control Panel.
My client once asked me if he indeed needs Plesk Power Pack license for his MS SQL (Express Edition) to run on  his Windows box. Absolutely not, I told him. However he said that 1and1's tech support clearly said it to him over the phone, that MS SQL won't run on Windows Server if he won't purchase the addon license (Power Pack). Well that's another example of stupidity from 1and1's technical support.


The Power Pack addon license for Plesk is only needed if you want to manage your MS SQL server from Plesk environment. That means having Power Pack license, you will be able create/delete MS SQL database/user from Plesk. You can also to a stop/start/restart of MS SQL from the Service Management function of Plesk.

If you won't buy Power Pack license, you can still use MS SQL in your Windows Server.
Just install Management Studio to manage it.

Tomcat down after reboot


Help! My Tomcat isn't running anymore after reboot!


Eh.. first thing's first. Verify if Tomcat is running or not. Login to your server through SSH and issue the following command:

-bash-3.2# telnet localhost 8080
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

 -bash-3.2# /etc/init.d/tomcat5 status
tomcat6 is stopped.

If you see those results, that means Tomcat isn't running in the first place.
Make sure that it's enabled for start-up. The next time your server will be rebooted, Tomcat should start.

To enable Tomcat for start-up, do:

-bash-3.2# chkconfig tomcat5 on

Why I'm with 1and1?

I know 1and1 US isn't as great as 1and1 DE (1und1 Germany). In fact, many have labeled 1and1 as the worst web hosting provider. Their technical support sucks big time, another example of how bad is outsouring. Their billing team is lazy, they normally reply to emails after 1 day. So I knew it, 1and1 isn't the your direct choice for web hosting if you're looking for a great support.

But why I am with 1and1? Uhm, I'm not. But my clients are with 1and1. I'm only doing the server administration for them. I recommend 1and1 the following reasons:
  • 1and1 has a very good route all over the world.
  • Their Data Center is in Kansas, that's pretty close to most audience of the various sites of my clients.
  • 1and1 is cheap! Yes, you get what you pay for!

I always inform my clients too that 1and1:
  • Has a poor technical support. But don't worry, you're paying me as your server admin. So I'll handle those stuff.
  • Their service is not designed for mission critical business applications. Talk about enterprise applications that runs on Jboss, Websphere and Weblogic.
  • Load balancing? Not 1and1.
  • Is not a True cloud computing provider that's highly automated and flexible.

So why I recommend 1and1 to my clients? Because I am very familiar with 1and1. I have use it for my personal needs for 2-3 years and it was great. The bandwidth was awesome, I was bursting up to 100mbps for a couple of days.

However I don't recommend it to everyone.