title: Deploy Angular 6 application on Apache 2
body: <p>I have a <code>Angular 6</code> application which I need to deploy on <code>Apache2</code>. 
  I have the code in <code>/var/www/html/project</code> folder. Have run <code>ng build --prod</code> command and it created a folder called <code>dist/project</code> under <code>/var/www/html/project</code></p>
  
  <p>Created the virtual host under <code>/etc/apache2/sites-available</code> and enabled the site and <code>apache2</code> reloaded.</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin webmaster@localhost
      ServerName testsite.com
      DocumentRoot /var/www/html/project/dist/project/
  
      &lt;Directory /var/www/html/project/dist/project/&gt;
              Options -MultiViews
              RewriteEngine on
  
              # Don't rewrite files or directories
              RewriteCond %{REQUEST_FILENAME} -f [OR]
              RewriteCond %{REQUEST_FILENAME} -d
              RewriteRule ^ - [L]
  
              # Rewrite everything else to index.html
              # to allow html5 state links
              RewriteRule . /index.html [L]
      &lt;/Directory&gt;
  
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>If I visit <code>testsite.com</code>, it is showing blank page.</p>
  
  <p>index.html </p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Project&lt;/title&gt;
  &lt;base href="http://testsite.com"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
    &lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;
    &lt;link href="https://fonts.googleapis.com/css?family=Montserrat:300,700" rel="stylesheet"&gt;
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"&gt;
    &lt;link rel="stylesheet" href="styles.8e98a03e860d2ebfdf70.css"
  &lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
     &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;
     &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;
     &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"&gt;&lt;/script&gt;
     &lt;script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="polyfills.2f4a59095805af02bd79.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="main.430ebc5e8a6533f9924f.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>