Category Archives: server management

Zend Framework: remove call to favicon.ico via .htaccess file

Almost all browser makes a query for /favicon.ico file. When you use ZF, all your queries that do not match an existing physical file are rerouted to your bootstrap file and therefore go through your entire app to end-up in a 404 error. Well this is a waste of computing resources and above all can drives you crazy when you’re tracking errors. You might not understand why your query runs twice on a single page load… A quick and easy way to fix this is simply to create an empty file, name it ‘favicon.ico’ and place it in your /public […]

how to list all cron jobs

If you want to list all cron jobs, let’s say to track down a process running widly on its own every day :-(, don’t forget to check the following: ls -l /var/spool/cron/crontabs then examine all user files check /etc/cron* folders content (cron.d, cron.hourly, cron.daily, cron.weekly, cron.monthly) sources http://forums.fedoraforum.org/showthread.php?t=126946

backup-manager running by itself!

I figured out that my backup-manager was running all alone by itself, despite me asking it to run through crontab already… In fact, I don’t know why, a script was automatically installed in /etc/cron.daily. This explains why I had the feeling that it was running all alone on its own… Let’s desactivate this script: sudo chmod a-x /etc/cron.daily/backup-manager note: this script may have been generated automatically when I installed backup-manager. with v.0.7.9, which I installed recently on another machine, such cron script was not automatically created. sources http://www.qc4blog.com/?p=945 contains instructions on how to list all your cron jobs to identify […]

Configure squid (proxy server) to hide your ip-address

Let’s say you use your server as a proxy for a website not to detect your country but rather the country where your server is located. If you’re using squid, by default squid still forwards your ip-address, to change this behaviour, proceed as follow: open squid configuration file : sudo vi /etc/squid3/squid.conf search for “forwarded_for” tag and set its value to off by adding the following line: forwarded_for off save your changes check your config file: sudo squid3 -k parse reload your configuration: sudo squid3 -k reconfigure That’s it! sources http://www.webhostingtalk.com/showthread.php?t=494612 http://www.cyberciti.biz/faq/squid-proxy-is-not-hiding-client-ip-address/

Apache: redirect to subdomain via .htaccess

Redirecting to subdomains is pretty easy with apache using <VirtualHost> directives. Problem is that such directives cannot be set in .htaccess file (only in .httpd.conf or equiv.) so we must find a workaround when server config files are not accessible (as with shared hosting…). The solution is to use mod_rewrite possibilities, provided your host activated .htaccess & mod_rewrite in apache… In my case, I simply want to redirect all queries without ‘www’ subdomain to ‘www’ subdomain. Here is my .htaccess content: RewriteEngine On RewriteBase / RewriteCond %{SERVER_NAME} ^mydomain.com$ [NC] RewriteRule ^(.*)$ http://www.%{SERVER_NAME}/$1 [L,R=301] Line by line, we did this: first […]

[solved] ssh connection frozen

When I logged to my server, my ssh connection kept freezing after a few (varying) moment of inactivity. This was extremely bothering me, I had to close my shell, open a new one and look for the pid of my action to know if it was completed… After searching the web, I found that some variables to prevent this behavior were not defined in my ssh configuration file. Basically what you can do is configure your server-ssh to periodically send live-packet queries so that it won’t close the connection for inactivity, or you can configure your client-ssh to send the […]

Upgrading to php5.3 – WordPress ending up with a blank page

When I updated my server (among other things I updated from php5.2.x to php5.3.x) and after my update, wordpress page was completely blank: index.php and wp-admin/index.php as well!!! I modified the file to ensure php logged errors and I checked the logs but nothing. Same things when activating display-errors and error_reporting(E_ALL). In fact, the problem was the following: php5.3 is a major php update, and when I installed it, I kept my old (customized) php.ini file. Fatal error! It looks like php handles db connection differently between 5.3 and 5.2 and this was the cause of my trouble. I restored […]

update of apache2 – websites no longer working

When I updated apache2 to a newer version, suddenly my previous webistes no longer worked! (in fact, my subdomains did not work). What I had to do was the following: reinstall ‘libapache2-mod-php5’ package – previous apache2 php module had been automatically removed and linking back to previous version of the module did not work sudo apt-get install libapache2-mod-php5 edit all my /etc/apache2/sites-available/* files and replace <VirtualHost *> with <VirtualHost *:80> for more info, read http://www.debian.org/releases/stable/i386/release-notes/ch-information.en.html#apache2 restart apache sudo /etc/init.d/apache2 restart That’s it. sources http://www.debian.org/releases/stable/i386/release-notes/ch-information.en.html#apache2

unable to update packages: package uses Breaks; not supported in this dpkg

I had a terrible evening figuring out what happened on my server, almost every time I tried to install a new package, it ended with an error and the following message: package uses Breaks; not supported in this dpkg I tried to follow hints left by error message content, ie. I tried to update dpkg (sudo apt-get install dpkg), the same error! => horrible chiken and egg dilemna. Well after researching the web for a few hours (…), I found that it is indeed a bug between two versions of dpkg and I was stuck in it. Breaking dpkg is […]

keeping your server’s clock up-to-date

Problem with computers is that day after day, they depart from real time. Today I checked the hour on my server and it returned “Thu Apr 15 17:25:40 CEST 2010” when in fact it was “Thu Apr 15 17:16:35 CEST 2010”, that is it suffered from close to a -10-minute lag! This is not good because when apache, db or other third party application is logging data, it’s not logging it on appropriate time. Moreover if later on you synchronize your time and by doing so “go back in time” then old entries becomes new entries and your really new […]