Howtos / Articles

Adding users to a .htpasswd file for Apache

This howto article shows you how to add a new user and password combination to a .htaccess file, for use with the Apache web server. This assumes the Apache tools are installed (specifically the ‘htpasswd’ utility).…

Read more [...]

Sticky Session Load Balancing with HAProxy

HAProxy provides a number of methods for maintaining a record of which backend server should handle a specific connection. This is known as creating a ‘sticky’ connection (other terms for this are ‘connection persistence’ and ‘connection affinity’). HAProxy can use the source ip address, url hash, cookies, sessions (checks cookies and url parameter), headers, and more, to determine which backend server to pass the connection to. Add one of the following lines to the HAProxy config file, in the section…

Read more [...]

Rewrite a http request to https with nginx

If you have a web server running nginx that accepts both http and https connections, there may be times where you want to prevent anyone from accessing a specific page/url using a insecure http connection. For example, login or registration pages. You always want these to be secure if you can. Add the following into the main “location /” block, located in the http “server” section in your nginx configuration file for your site. if ($request_uri ~* “/login.php”) { rewrite…

Read more [...]

Remove nginx version from HTTP response headers

Its usually a good idea to prevent users from being able to determine the version number of the web server software you are using. This helps prevent people from then going and looking for known vulnerabilities in that specific version, and attacking your site. When a HTTP response comes back to the web browser, it also includes a number of headers. One of these headers is the “Server” header. This is used to identify the web server software being used.…

Read more [...]

Installing HAProxy on CentOS 6

This guide will step you through the process of installing HAProxy on CentOS 6. To install HAProxy on CentOS 6 you first need to set up your installation to use the epel software repository. HAProxy is not available in the default CentOS repositories. (Note: All commands below require root privileges.) rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm You can now install haproxy. yum -y install haproxy Now that HAProxy is installed, you can configure the haproxy.cfg file. vi /etc/haproxy/haproxy.cfg Once you have configured HAProxy,…

Read more [...]