Apache Server Installation

  1. Copy pathlay folder to your apache directory of choice, default is /var/www/html/:

    cp -r pathlay /var/www/html/
    
  2. Enable apache modules:

    a2enmod cgid
    a2enmod rewrite
    a2enmod headers
    a2dissite 000-default
    systemctl reload apache2
    
  3. Add the following configuration to the /etc/apache2/apache2.conf file:

    <FilesMatch "\.(ttf|otf|eot|woff|js|css|woff2)$">
      <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
      </IfModule>
    </FilesMatch>
    
  4. Add the following configuration to the /etc/apache2/sites-enabled/localhost.conf file:

    ServerName localhost
    AddHandler cgi-script .cgi .pl
    
    <Directory '"$chosenPath"'>
      Header set Access-Control-Allow-Origin "*"
      Options All
      AllowOverride All
    </Directory>
    

    If the file doesn’t exist, create it. Be sure to replace “$chosenPath” with the location of the pathlay directory.

  5. Setup environment variables:

    export APACHE_RUN_USER="www-data"
    export APACHE_RUN_GROUP="www-data"
    export APACHE_PID_FILE="/var/run/apache2.pid"
    export APACHE_RUN_DIR="/var/run/apache2"
    export APACHE_LOCK_DIR="/var/lock/apache2"
    export APACHE_LOG_DIR="/var/log/apache2"
    
  6. Setup permissions and ownership:

    chgrp -R www-data "$chosenPath"
    chmod -R 774 "$chosenPath"
    chmod g+s "$chosenPath"
    

    Be sure to replace “$chosenPath” with the location of the pathlay directory.