Click On Tyler Support

Contact Us

Support Home » VirtualHostX » How to Enable Perl / CGI Scripts in VirtualHostX

How to Enable Perl / CGI Scripts in VirtualHostX

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 window to log in to the virtual machine.
  2. Run this command "sudo a2enmod cgid"

Next, create a new website in VHX. For the "Domain 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 "Apply Changes" 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 following URL:

(If you want to get rid of the ugly :8080 port number at the end of your URLs, instructions are available here.)

Configuring Perl scripts in VirtualHostX

Your vote was sent, thanks!
Was this article helpful?


Contact Us