Snippets tagged "apache" Snippets tagged "apache"

Configuration de base d'un VHost pour Apache

NameVirtualHost www.mywebsite.com:port
<VirtualHost www.mywebsite.com:port>
 
ServerAdmin admin@mywebsite.com
DocumentRoot /path_to_htdocs/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path_to_htdocs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error-mywebsite.log
LogLevel warn
CustomLog /var/log/apache2/access-mywebsite.log combined
</VirtualHost>

A placer dans un fichier dans /etc/apache2/sites-enable/

by Aurélien Vialet on 2007-10-09, tagged apache  conf  vhost 
(2 comments)

Redirect HTTP -> HTTPS requests in a VirtualHost

<VirtualHost 100.101.102.103:80>
 
  ServerName    subdomain.domain.tld
  DocumentRoot  /path/to/docroot
 
  <IfModule mod_rewrite.c>
    RewriteEngine   on
    RewriteLog      /var/log/apache2/https_rewrite.log
    RewriteLogLevel 1
    RewriteCond     %{SERVER_PORT} !^443$
    RewriteCond     %{SERVER_NAME} ^subdomain.domain.tld$
    RewriteRule     ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
  </IfModule>
 
</VirtualHost>
 
<VirtualHost 100.101.102.103:443>
 
  ServerName    subdomain.domain.tld
  DocumentRoot  /path/to/docroot
 
  SSLEngine On
  SSLCertificateFile     /etc/apache2/ssl_conf/myservicename.crt
  SSLCertificateKeyFile  /etc/apache2/ssl_conf/myservicename.key
 
 
</VirtualHost>
by Nicolas Perriault on 2006-12-19, tagged apache  http  https  server  sysadmin