There are little to no installation notes provided with the Miva Empresa CGI engine. So in lieu of that, here are my notes for how to get Miva up and running. My linux skills are mostly google-fu, so I've included some steps that are probably not needed if you're an experienced linux user.
I've created these steps based on my experience with debian and ubuntu. You may have to modify them for other distros, or you may not.
- Assuming a linux instance with nothing else yet installed...
- Install Apache sudo apt-get install apache2
- Install these two Apache mods: sudo a2enmod actions and sudo a2enmod cgi
- Download the latest Miva Empresa version from here: http://www.mivamerchant.com/support/downloads
- Upload it to the server and tar -zxvf it
- Copy the cgi-bin and lib folders to /usr/local/miva/ and chmod 755 -R the miva folder
- Over in your /etc/apache2/sites-available folder, you'll need to customize your Virtual Host. Edit the host file you want Miva running on.
- You'll want to add (or modify) the line line DirectoryIndex index.mvc index.html to allow Miva's .mvc files be the index files
- Add these lines
ScriptAlias /miva-bin/ /usr/local/miva/cgi-bin/ <Directory /usr/local/miva/cgi-bin/> Require all granted </Directory>
- Add these lines (a copy of this is in the README file) making the replacements in italics:
SetEnv MvCONFIG_LIBRARY /usr/local/miva/lib/config/env.so SetEnv MvCONFIG_DIR_MIVA [your site's html folder] SetEnv MvCONFIG_DIR_DATA [your site's mivadata folder] SetEnv MvCONFIG_DIR_BUILTIN /usr/local/miva/lib/builtins AddHandler application/x-miva-compiled .mvc Action application/x-miva-compiled /miva-bin/mivavm-v[latest]
- You will need to create the html and mivadata folders mentioned in the step above before restarting apache. The mivadata folder should not be inside the html folder. The way I prefer is putting them is for html: /usr/local/web/SITE NAME/site/ and data: /usr/local/web/SITE NAME/data/. Once those folders are created, change their ownership with chown -R username:www-data and then chmod 0775 -R them. There may be a better way of doing this.
- You should now be finished. Restart apache sudo systemctl restart apache. To test your site, put a Mivascript file in the root which creates a database file and writes to the script directory. If your Mivascript can do both those things, then things are working!
Here's how to install the Mivascript compiler (this is much easier):
- Download the compiler from the same place as the above link
- tar -zxvf it
- Move the contents of bin to /usr/local/bin and the contents of builtins to a new directory /usr/local/include/miva/
- Either add this to your ~/.profile file or (if you want to install for all users) the /etc/profile file: MVC_LIB=/usr/local/include/miva
- You should now be able to run mvc file.mv and have it successfully make a file.mvc compiled Mivascript file