Archive

Articles taggués ‘HTTP’

Protéger ses images contre le Hotlinking

24/01/2024 Comments off
fonctionnement-hotlinkLe hotlinking est une pratique courante qui consiste, le plus souvent, à afficher une image en utilisant l’adresse URL en provenance d’un autre site où elle est publiée. En fait, au lieu de stocker l’image sur son serveur, le hotlinkeur crée un lien direct vers le serveur d’origine.Principe du Hotlinking en schéma.Cette méthode est totalement illégale puisqu’il s’agit d’un vol de bande passante. En effet, à chaque fois que l’image est visionnée par un internaute, une requête HTTP est envoyée vers le serveur qui l’héberge. Cela ralentit le serveur qui doit fournir les images hotlinkées en plus des images du site d’origine. De plus, cela peut engendrer un coût financier supplémentaire puisque certains hébergeurs prennent en compte le trafic mensuel de données afin d’éviter les abus et de préserver la bande passante.

Pour lutter contre le hotlinking, il suffit de copier le code suivant dans le fichier .htaccess présent à la racine de votre projet. Il permet de remplacer l’image volée par une autre destinée à dissuader le hotlinkeur (par ex: http://p7.storage.canalblog.com/78/13/603253/75105879.jpg).

RewriteEngine On
# Remplacer mywebsite\.com/ par l'adresse de votre site
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mywebsite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
# Remplacer /images/nohotlink.jpg par le chemin de l'image affichée chez les voleurs
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

mod_geoip2 Apache module

22/01/2024 Comments off

The mod_geoip2 module embeds GeoIP database lookups into the Apache web server. It is only capable of looking up the IP of a client that connects to the web server, as opposed to looking up arbitrary addresses.

This module works with Apache 2. Please use mod_geoip with Apache 1.

Installation

You may download the latest release of mod_geoip2 or get the latest development version from GitHub. See the included INSTALL file in the tarball for installation details.

Overview

The mod_geoip2 module uses the libGeoIP library to look up geolocation information for a client as part of the http request process. This module is free software, and is licensed under the Apache license.

To compile and install this module, you must first install libGeoIP 1.4.3 or newer.

The mod_geoip2 module takes effect either during request header parsing phase or the post read request phase, depending on whether it is configured for server-wide use or for a specific location/directory.

When enabled, the module looks at the incoming IP address and sets some variables which provide geolocation information for that IP. The variables it set depend on the specific GeoIP database being used (Country, City, ISP, etc.). These variables can be set in either the request notes table, the environment or both depending on the server configuration.

Lire la suite…

Virtual host on ubuntu 13.10 and apache 2.4.6

14/01/2024 Comments off

I have the fallowing problem
My hosts file is as follows:

127.0.0.1       localhost
127.0.1.1       barbala4o-HP-ProBook-4530s
127.0.1.1       mysite.localhost

My file in the /etc/apache2/sites-available/mysite.localhost.conf is as follows :

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mysite.localhost

        DocumentRoot /var/www/mysite

        <Directory /var/www/mysite/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>

Lire la suite…

Categories: Logiciel, Système Tags: , ,

Rediriger un nom de domaine vers un sous-répertoire

14/01/2024 Comments off

Quand votre nom de domaine pointe vers un hébergement mutualisé, vous n’avez, la plupart du temps, pas le droit de modifier les VirtualHost du serveur Apache.

Virtual Hosts

Virtual Hosts

Pour pallier ce manque, une redirection s’impose mais par un autre biais: l’utilisation de l’URL Rewrting. Lire la suite…

How To Use Apache JMeter To Perform Load Testing on a Web Server

30/12/2023 Comments off

Introduction

In this tutorial, we will go over how to use Apache JMeter to perform basic load and stress testing on your web application environment. We will show you how to use the graphical user interface to build a test plan and to run tests against a web server.

JMeter is an open source desktop Java application that is designed to load test and measure performance. It can be used to simulate loads of various scenarios and output performance data in several ways, including CSV and XML files, and graphs. Because it is 100% Java, it is available on every OS that supports Java 6 or later.

 

Prerequisites

In order to follow this tutorial, you will need to have a computer that you can run JMeter on, and a web server to load test against. Do not run these tests against your production servers unless you know they can handle the load, or you may negatively impact your server’s performance.

You may adapt the tests in this tutorial to any of your own web applications. The web server that we are testing against as an example is a 1 CPU / 512 MB VPS running WordPress on a LEMP Stack, in the NYC2 DigitalOcean Datacenter. The JMeter computer is running in the DigitalOcean office in NYC (which is related to the latency of our tests).

Please note that the JMeter test results can be skewed by a variety of factors, including the system resources (CPU and RAM) available to JMeter and the network between JMeter and the web server being tested. The size of the load that JMeter can generate without skewing the results can be increased by running the tests in the non-graphical mode or by distributing the load generation to multiple JMeter servers.  Lire la suite…