Apache Installation Instructions

Purpose

This document will serve as a series of alternate instructions for those that which to use Apache 2 rather than NGinx as their web server.

But why?

My server hosts other software, and already had Apache2 installed. Why not publish my notes?

Requirements/Assumptions

  1. Comfortable enough to run the commands found here: DigitalOcean Self-Install - AresMUSH
  2. Apache2 installed on your server.
    1. mod_rewrite installed (a2enmod rewrite)
    2. mod_proxy installed (a2enmod proxy)
    3. mod_proxy_http installed (a2enmod proxy_http)
  3. Apache2 is already hosting another site (while this isn’t strictly necessary, some of the steps in this document will be overkill – that said, it will all still work)

Instructions

How to use these instructions

These instructions will interrupt the instructions found in DigitalOcean Self-Install - AresMUSH with additional steps (usually by editing the files found there, and adding additional steps). The document will call out which steps in the Tutorial it will interrupt, and which steps to take.

  1. Set Up the Server
    1. Step 2
      1. After chmod +x setup_server:
        1. In setup_server:
          1. Disable nginx install by commenting out the following lines:
          apt-get install -y nginx
          
  2. Install the Game
    1. Step 2
      1. After chmod +x install:
        1. In install:
          1. Disable the symbolic link to the web install by commenting the following lines:
            cd /var/www/html/
            ln -s "${HOME_DIR}/aresmush/game" game
            
          2. Disable the web configuration by commenting the following lines:
            cp "${HOME_DIR}/aresmush/install/nginx.default" /etc/nginx/sites-available/default
            sudo service nginx restart
            
          3. Disable the startares command by commenting the following line:
            bin/startares
            
      2. After ./install:
        1. Choose and create your web deployment directory (we will choose /var/www/myaresmush.com for this document.)
        2. Within your web deployment directory, create a symbolic link to the game directory
          cd /var/www/myaresmush.com
          ln -s /home/ares/aresmush/game game
          
        3. In ares-webportal/bin/deploy
          1. Change /var/www/html on the last line to the web deployment directory.
        4. Update your apache site conf
          1. Ubuntu 22.04 users will edit /etc/apache2/sites-available/000-default.conf. Consult your distro/Apache install for specifics

          2. Add a Virtual Host entry with the following values (this assumes a hostname of myaresmush.com, a web deploy directory of /var/www/myaresmush.com, and default ports):

            <VirtualHost *:80>
                DocumentRoot "/var/www/myaresmush.com"
                ServerName myaresmush.com
                ProxyPreserveHost On
                ProxyPass "/websocket" "https://127.0.0.1:4203"
                ProxyPassReverse "/websocket" "https://127.0.0.1:4203"
                ProxyPass "/api" "https://127.0.0.1:4202"
                ProxyPassReverse "/api" "https://127.0.0.1:4202"
                
                ErrorLog ${APACHE_LOG_DIR}/myaresmush.com/error.log
                CustomLog ${APACHE_LOG_DIR}/myaresmush.com/access.loc combined
            
                <Directory /game/>
                    RewriteEngine on
                    RewriteRule "(config|help|logs|text)" - [R=404]
                </Directory>
            </VirtualHost>
            
          3. Create the logs directory specified in the previous step (${APACHE_LOG_DIR}/myaresmush.com)

          4. Restart apache (sudo systemctl restart apache2)

          5. Run startares (./bin/startares)

TL;DR

Setup to an alternate web server like Apache2 requires three main changes: your Apache conf, the deploy script so that it deploys the files to the correct directory, and to the install scripts so that they don’t clobber any existing files.

1 Like

Cool. Thanks for sharing!

You’ll also need to modify the web portal deployment script to put the files in the chosen directory. (It uses the nginx path by default).

That’s step… 2.2.3, right? Or did I miss it in a different spot?

3. In `ares-webportal/bin/deploy`
    1. Change `/var/www/html` on the last line to the web deployment directory.

Oh - yeah I’m just blind. Carry on!

1 Like