Skip to content

Instantly share code, notes, and snippets.

@NerOcrO
Last active November 6, 2018 15:51
Show Gist options
  • Save NerOcrO/5990575 to your computer and use it in GitHub Desktop.
Save NerOcrO/5990575 to your computer and use it in GitHub Desktop.
apache

Active mon fichier de conf

sudo a2ensite perso.conf

Active un module

sudo a2enmod rewrite

Local images mode (proxy style)

sudo a2enmod proxy

sudo a2enmod proxy_http

vim .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule files/(.*) http://static.mdp.fr/files/$1 [P,L]
</IfModule>

Or virtual host mode

<Location /files>
    RewriteEngine on
    RewriteRule files/(.*) http://static.mdp.fr/files/$1 [P,L]
</Location>

Ajouter un virtual host en incluant le .htaccess (moins d'accès disque)

http://httpd.apache.org/docs/current/fr/howto/htaccess.html#when

sites-available/perso.conf :

 <VirtualHost *:80>
   DocumentRoot /var/www/drupal7
   ServerName   xxx.drupal7.fr
   Include      sites-available/drupal7.conf
 </VirtualHost>

sites-available/drupal7.conf :

 <Directory />
  AllowOverride None
  Include /var/www/drupal7/.htaccess
</Directory>
# sudo vim /etc/apache2/conf-available/zperso.conf
# sudo a2enconf zperso.conf
# sudo a2disconf other-vhosts-access-log
# Évite un petit warning au lancement d'Apache2.
ServerName localhost
# Supprime les informations liés au serveur de l'en-tête d'une page.
ServerTokens Prod
# Désactivation des logs error.
ErrorLog /dev/null
# Désactivation des logs d'access
# Commenter CustomLog dans sudo vim /etc/apache2/sites-available/000-default.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment