Skip to content

Deploying with Ubuntu Apache2

Elvis de Souza edited this page Nov 2, 2021 · 24 revisions

In order to deploy Interrogatório using Ubuntu/Apache2, run the following commands in the web server console:

  1. Install Apache2:
$ sudo apt-get update
$ sudo apt-get install apache2
  1. Clone Interrogatório repository in /var/www:
$ cd /var/www
$ sudo git clone https://github.com/alvelvis/Interrogat-rio --recursive
  1. Install the needed packages:
$ cd Interrogat-rio
$ pip3 install -r requirements.txt
$ sudo sh install_interrogatorio.sh
$ sudo ln -rs www/cgi-bin www/interrogar-ud www/cgi-bin
$ sudo ln -rs .interrogatorio www

After the server is started for the first time, press Ctrl+C to terminate it.

  1. Configure Interrogatório virtual host inside Apache2, creating a new file and pasting the text that follows the command inside it (Shortcuts: Ctrl+W inside nano editor to search, Ctrl+X to save the file). Remember to edit the line ServerName.
$ sudo nano /etc/apache2/sites-available/interrogatorio.conf
<VirtualHost *:80>
    ServerName interrogatorio.comcorhd.ga
    DocumentRoot /var/www/Interrogat-rio/www

    ScriptAlias /cgi-bin /var/www/Interrogat-rio/www/cgi-bin
    <Directory /var/www/Interrogat-rio/www/cgi-bin>
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AddHandler cgi-script .py .cgi
        Order deny,allow
        Allow from all
        PassEnv LANG
    </Directory>
</VirtualHost>
  1. Activate the newly created virtual host:
$ sudo a2ensite interrogatorio
  1. Activate cgi mod:
$ sudo a2enmod cgi
  1. Set the default language: edit the file /etc/apache2/envvars, look for export LANG= and change the value to C.UTF-8 (Shortcuts: Ctrl+W inside nano editor to search, Ctrl+X to save the file):
$ sudo nano /etc/apache2/envvars
  1. Start Apache2:
$ sudo service apache2 start

Optional: Apache2 authentication

In case you want to activate an authentication step so that only known users will have access to Interrogatório, run the following commands:

  1. Download Apache2 authentication package:
$ sudo apt-get update
$ sudo apt-get install apache2 apache2-utils
  1. Create the first user credentials, changing the "USERNAME" in the command below:
$ sudo htpasswd -c /etc/apache2/.htpasswd USERNAME
  1. To add new users, run the following command for each user, changing the "USERNAME":
$ sudo htpasswd /etc/apache2/.htpasswd USERNAME
  1. Edit Interrogatório virtual host file, adding the text that follows the command inside the <Directory /var/www/Interrogat-rio> block (Shortcuts: Ctrl+W inside nano editor to search, Ctrl+X to save the file):
$ sudo nano /etc/apache2/sites-available/interrogatorio.conf
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
  1. Restart Apache2:
$ sudo service apache2 restart