Category: Apache

Determine Most Active Site

On a server with many domains it can be difficult to determine which sites are taking the most traffic. Here’s a one-line that will generate a nice report:

This assumes that (a) log files are in /var/log/httpd, (b)  log file names end with “access.log” and that each domain has it’s own access list.      

Read More »

Block By X-Forwarded-For In .htaccess

To block access except for a single IP address in the .htaccess file the code is:

If you’re behind a load balancer then you have to use the X-Forwarded-For header instead:

 

Read More »

Reverse Proxy For eScan Web Control Panel

Recently I installed “eScan for Linux Servers” on one of our client’s server. eScan has a great Linux virus scanner. In addition to a command line utility, it provides a web interface. The web interface runs on port 10443 by default. The problem is the client’s server was firewalled and I didn’t want to open a new port just for eScan. So I setup a reverse proxy in Apache on a virtual hosts. It got interesting when I discovered that the web interface was embedding internal urls in to the content so I had to add mod_filter and mod_substitute. Here’s the final config:

Similar configuration could be used to map other odd-port web interfaces into a virtual host.

Read More »

Discourage HTTPS On WordPress

Recently we had a WordPress site where that used HTTPS (SSL) on the login/admin areas. But we wanted to discourage HTTPS for non-admin URL. Here are the rewrite rules that ended up using in a .htaccess file:

Read More »

Block PHP Execution With .htaccess In Folder

For a server using Plesk add the following lines to a .htaccess file to stop execution of PHP scripts in the folder:

I like to use this to protect cache and image upload folders that are writable by the web server but should not be able to execute code. As a further precaution, chown the .htaccess to root, so it can’t be overwritten by Apache or FTP, and “chattr +i” to be sure about it.

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.