Click On Tyler Support

Contact Us

Support Home » VirtualHostX » How To's

How to Enable Perl / CGI Scripts in VirtualHostX

Last Updated December 9, 2019

While it's not enabled by default in VirtualHostX, you can configure the web server yourself to serve Perl scripts using CGI.

(That's the great thing about VHX - it uses a real Ubuntu Linux virtual machine. So, you can pretty much just google for anything you want to do and you'll find tons of instructions, then you can customize the VM as much as you want without worrying about harming your Mac's system files.) Anyway...

After you've gone through the VirtualHostX Welcome Window steps, you'll need to enable the web server's cgi module.

  1. Click the "Terminal" button in the VHX toolbar to log in to the virtual machine.
  2. Run this command sudo a2enmod cgid

Next, create a new website in VHX. For the "Website Name" field, enter whatever you'd like. In our example, let's put perl-test.

Then, choose a "Local Path" that points to the folder on your Mac containing your Perl scripts.

To tell the web server to run your scripts when you view them in your browser, you need to add the following lines to your website's "Custom Directives" boxes in VHX.

For the box, add:

ScriptAlias / /var/www/

(In the future, you would replace "perl-test" with whatever you chose as your "Domain Name" and append "")

For the box, add:

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Finally, click the "checkmark" toolbar button to save your settings and restart the web server.

If all goes well, you should be able to access your Perl scripts at the Local URL that VHX gives you.