background preloader

Apache

Facebook Twitter

.htaccess snippets to optimize your website. All of the snippets below have to be pasted into your .htaccess file, which is located on the root of your Apache server. Waring: Always make sure you have a working backup before editing your .htaccess file! Force trailing slash Many clients of mine asked me for always having a trailing slash at the end of their urls. Looks like it’s great for SEO. <IfModule mod_rewrite.c> RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] </IfModule> Source: Prevent hotlinking Hotlinking (the act of using images from another site than yours) is unfortunely a common practice which can waste lots of your precious bandwidth.

Source: Redirect mobile devices If your site is not using responsive web design yet, it could be very useful to be able to redirect mobile device to a mobile-specific version of your website. RewriteEngine On RewriteCond %{REQUEST_URI} ! <FilesMatch "\. Log PHP errors. Disabling unnecessary modules. The Debian Administrator's Handbook. The Falcot Corp administrators decided to use the Apache HTTP server, included in Debian Squeeze at version 2.2.16. 11.2.1. Installing Apache By default, installing the apache2 package causes the apache2-mpm-worker version of Apache to be installed too. The apache2 package is an empty shell, and it only serves to ensure that one of the Apache versions is actually installed. The differences between the variants of Apache 2 are concentrated in the policy used to handle parallel processing of many requests; this policy is implemented by an MPM (short for Multi-Processing Module).

Among the available MPMs, apache2-mpm-worker uses threads (lightweight processes), whereas apache2-mpm-prefork uses a pool of processes created in advance (the traditional way, and the only one available in Apache 1.3). apache2-mpm-event also uses threads, but they are terminated earlier, when the incoming connection is only kept open by the HTTP keep-alive feature. 11.2.2.

Example 11.16. Example 11.17. 11.2.3. Visual Domain Routing. When troubleshooting a website issue, if you were to start at step 1, it would be checking to make sure that your domain name is registered and that the DNS is routing your domain name to the correct web server. When checking the routing of a domain name, most professional use tools such as dig / ping / tracert. For the average user that does not perform this type of test on a regular basis, connecting the dots to see how a domain name is routing can be quite difficult. To help everyone, we've created a tool that performs the necessary lookups that check where a domain name is routing, and it graphically displays this information for easy review. Please enter a domain name below and click submit to see where your domain's website and email traffic is being routed to on the internet. Want to see some cool examples, try the following! Google.com yahoo.com microsoft.com BETA! Apache 2 on Debian 7 (Wheezy.

This tutorial explains how to install and configure the Apache web server on Debian 7 (Wheezy). Note that if you're looking to install a full LAMP stack, you may want to consider using our LAMP guide for Debian 6. Make sure you've followed the Getting Started guide.As part of the Getting Started guide, make sure you set the hostname for your server. Issue the following commands to make sure your hostname is set properly: hostname hostname -f The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN). All of the commands in this article should be executed either as root or as a user with sudo access. The following commands install Apache support for server-side scripting in PHP, Ruby, Python, and Perl. To install Ruby support, issue the following command: apt-get install libapache2-mod-ruby To install Perl support, issue the following command: apt-get install libapache2-mod-perl2 To install Python support, issue the following command: Note.

Hosting multiple websites with Apache2. Posted by Steve on Thu 6 Jul 2006 at 22:03 One of the most common Apache2 questions I've seen on Debian mailing lists is from users who wonder how to host multiple websites with a single server. This is very straightforward, especially with the additional tools the Debian package provides. We've previously discussed some of the tools which are included in the Apache2 package , but what we didn't do was show they're used from start to finish.

There are many different ways you can configure Apache to host multiple sites, ranging from the simple to the complex. Here we're only going to cover the basics with the use of the NameVirtualHost directive. The advantage of this approach is that you don't need to hard-wire any IP addresses, and it will just work tm . The only thing you need is for your domain names to resolve to the IP address of your webserver. (This might mean that you need example.com and www.example.com to resolve to the same address.

/etc/apache2/sites-available Now we've got: