Question

How can I configure cgi-bin on each of my virtual hosts?

Currently I have it configured in one of my virtual hosts but I need each virtual host to have its own configuration


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 6, 2023

Hi there,

I believe that you could do that by using a ScriptAlias directive in each Apache virtual host configuration. The ScriptAlias directive specifies the URL path that will be used to access CGI scripts and the file system directory where the scripts are stored:

https://httpd.apache.org/docs/2.4/howto/cgi.html

For example, you would add the following in your virtual host:

ScriptAlias /cgi-bin/ /var/www/html/example.com/cgi-bin/

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up