Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Usually the best place for a VirtualHost is a new file in the sites-available folder.prfixed with a number like <code>100-</code>.</p> <p>So something like <code>sites-available/100-443-myproject.example.com</code>.</p> <p>This way when you will use the <code>ae2ensite</code> and <code>a2dissite</code> commands you will have the default and the <code>myproject.example.com</code> in lists of websites to enable or disable.</p> <p><code>000</code> is the reserved number fr the default Virtualhost, as apache reads files from sites-enabled directory in alphabetic order, and the default virtualhost should be the first one (the default virtualhost catch all bad formatted host HTTP header, when no <code>VirtualHost</code> <code>ServerName</code> is matching).</p> <p>If your VirtualHost is for the port 80 you will have to use a <code>&lt;VirtualHost *:80&gt;</code> configuration directive (or <code>&lt;VirtualHost &lt;my IP&gt;:80&gt;</code>, depends of the <code>NameVirtualHost</code> setting). If your VirtualHost is for the SSL port, and it's your case, You will have to use <code>&lt;VirtualHost *:443&gt;</code>, and you will have to ensure with <code>a2ensite</code> and <code>a2dissite</code> that this Virtualhost is the only SSL enabled VirtualHost defined (so ssl-default shouldn't be enabled).</p> <p>With port 80 the <code>ServerName</code> instruction is enough for apache to decide which VirtualHost should be taken. With port 443 and SSL this is not enough as SSL negociation is made before the Host header/<code>ServerName</code> can be matched. So Multiple SSL Vh have to use different ports or use the new SNI system <a href="http://wiki.apache.org/httpd/NameBasedSSLVHosts" rel="nofollow">as described here for example</a>.</p> <p>Now for the <code>AllowOverride</code> you do not need to put that in main configuration (but you could, using the <code>/etc/apache2/conf.d</code> directory for such shared-by-all Virtualhosts configuration stuff). Your VirtualHost can contain enough instructions, like:</p> <pre><code>&lt;Virtualhost (....) ServerName (...) (...) &lt;Directory /&gt; # Forbid .htaccess for all the filesystem directory tree AllowOverride None &lt;/Directory&gt; &lt;Directory /path/to/somewhere&gt; # I am mad and I like slow apache server # So I want to allow .htaccess files # Instead of putting all the content of this .htaccess right here # in a Directory section AllowOverride All &lt;/Directory&gt; &lt;/VirtualHost&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload