Category Archives: Apache-Nginx

.htaccess File to Make Your Site Accessible via HTTPS Only

If you have a SSL certificate installed, you might want to force your visitors to use secure version of it. Sometimes you cannot modify httpd.conf, the only file that can resolve the issue is .htaccess. Let me paste the code below to help you set this up. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} This code checks… Read More »

How to Upgrade Apache From 1.3 to 2.0 on a Directadmin Server

When you get your new Directadmin server, it comes with default settings like Apache 1.3 and PHP4. I have already written how to update PHP version to PHP5. Today I will post a solution that can be used to upgrade your apache installation on a Directadmin server. The idea is not mine, it is taken from Directadmin Official… Read More »

How to Find Which Script Causes Most Apache Load

It is often hard to tell which process causes most Apache load. top and ps -aux commands don’t give us anything usable; they only allow us to see that Apache causes server load. We need to identify which scripts are not so good for server load and fix them. The first advice is to view Apache server status.… Read More »

How to Check if Apache Is Up and Restart if Not

I do often monitor server apache status as most often reason of server outages is Apache overload. Some web hosting panels are sending notifications when your server is down; some web services like Alertra.com provide you with different notification options and one of my hosters has his internal monitoring service. But what to do if you need to… Read More »

Regular Expression to Parse Text Between Simple Tags (XML)

It is often necessary to extract text from a variable that contains HTML or XML code. I’ve created a simple regular expression that will help you to extract all text between certain tags into an array. It is a PHP solution, though regular expression is compatible with other programming languages. preg_match_all(“/<tag>(.*?)</tag>/”, $source, $results); This construsion will create an… Read More »