Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 2 KB

Deployment-Apache.md

File metadata and controls

63 lines (49 loc) · 2 KB

Apache Deployment

Requirements

The app requires a couple of packages you need to install on your system. Those are:

  • Apache >= 2.2
    • mod_rewrite
  • PHP >= 7.1
  • MySQL, MySQL-PDO

You need to install and enable mod_rewrite. You can do this by following this SO answer or simply run the commands (as root):

a2enmod rewrite
service apache2 restart

Configuration

Configure Apache to run the application from the src directory and make sure to ether AllowOverride All or move the rewrite rule from .htaccess to the VirtualHost config.

With .htaccess:

<VirtualHost *:80>
        DocumentRoot /var/www/scrumonline/src

        <Directory /var/www/scrumonline/src>
           AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Without .htaccess:

<VirtualHost *:80>
        DocumentRoot /var/www/scrumonline/src

        RewriteEngine on

        # Rule that includes session and member id
        RewriteRule ^/api/(\w+)/(\w+)/(\d+)/(\d+) /api.php?c=$1&m=$2&id=$3&mid=$4 [QSA]
        # Rule that includes the session id, mostly used for HTTP GET
        RewriteRule ^/api/(\w+)/(\w+)/(\d+) /api.php?c=$1&m=$2&id=$3 [QSA]
        # Standard rule for controller and method - applies to most queries
        RewriteRule ^/api/(\w+)/(\w+) /api.php?c=$1&m=$2 [QSA]

        # The angular HTML mode rewrite needs to be in the directory tag because of reasons...
        # http://tltech.com/info/rewriterule-in-htaccess-vs-httpd-conf/
        <Directory /var/www/scrumonline/src>
          # Rewrite all other calls to index.php
          RewriteCond %{REQUEST_FILENAME} !-f 
          RewriteCond %{REQUEST_FILENAME} !-d 
          RewriteCond %{REQUEST_FILENAME} !-l
          RewriteRule . index.php [L]
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>