title: Configuring Apache for localhost
body: <p>I am new to Linux and Apache. I have tried to configure Apache2 to serve a website I develop on my local Linux Mint machine. I have not attepted to use PHP yet.</p>
  
  <p>In spite of trying to follow all the instructions, I still got a 404 Not Found or 403 Forbidden.</p>
  
  <p>The name of the directory that holds the website is Web and has permissions</p>
  
  <pre><code>drwxr-xr-x  4 www-data www-data   4096 May 15 18:46 Web
  </code></pre>
  
  <p>I also tried my own user group with no luck. All files inside Web have the usual r-x or r-- permissions for both Group and Others.</p>
  
  <p>/etc/hosts is</p>
  
  <pre><code>127.0.0.1   localhost
  </code></pre>
  
  <p>/etc/apache2/ports.conf is</p>
  
  <pre><code>Listen 127.0.0.1:80
  </code></pre>
  
  <p>/etc/apache2/sites-available/Web.conf is</p>
  
  <pre><code>&lt;VirtualHost 127.0.0.1:80&gt;
  
      ServerName Web
  
      ServerAdmin webmaster@localhost
      DocumentRoot /xxx/xxxx
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Note that /xxx is my custom partion on my local machine and xxxx is a directory in this partion.</p>
  
  <p>/etc/apache2/sites-enabled is</p>
  
  <pre><code>lrwxrwxrwx 1 root root 27 May 23 13:04 Web.conf -&gt; ../sites-available/Web.conf
  </code></pre>
  
  <p>Finally, the /etc/apache2/apache2.conf included this</p>
  
  <pre><code>&lt;Directory /xxx/xxxx/Web/&gt;
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I finally did get localhost to work, but it was not as above. I simply made a link to the directory Web in /var/www/html.</p>
  
  <p>/var/www/html is</p>
  
  <pre><code>-rw-r--r-- 1 root root 11321 Apr 14 15:11 index.html
  lrwxrwxrwx 1 root root    17 May 22 16:54 Web -&gt; /xxx/xxxx/Web
  </code></pre>
  
  <p>This worked with no chances in apache2.conf and I did not have to enable the site (make a link with a2ensite).</p>
  
  <p>The url  </p>
  
  <pre><code>localhost/Web  
  </code></pre>
  
  <p>now works with no errors.</p>
  
  <p>It works, but it can not be the right way. What am I doing wrong? </p>