How To Add A Custom CGI BIN Directory In Parallels
Posted by Dexter Nelson: Tuesday, November 19, 2013 (3:09 PM)
Good afternoon!
Today I have something I wanted to share really quickly.
I've noticed that a lot of people are wondering how you can set a custom cgi-bin or script directory if you're using Parallels Panel, especially since they limit the choice to the document root of the domain or the root directory of the webspace.
This is how I did it.
I have a huge application on one of my websites and scripts needed to be called differently (mostly because of the SSL certificate - I didn't want to buy a second, when i could solve the problem with a simple line of text).
So I have http://music.echoingwalls.com/cgi-bin/musicsense.cgi, however I also needed https://echoingwalls.com/music-sense/cgi-bin/musicsense.cgi to work, (you can click on them - they work now).
Note: Adding the sub domain was a recent addition when i created a member center and wanted to bring a measure of uniformity for sessions.
Continuing on, I had the same problem as most people did - I couldn't add a custom cgi-bin directory (ScriptAlias) within Parallels and many of the solutions I found simply didn't work; so I went back to basics.
In Parallels, the file you need to edit is /etc/httpd/conf/httpd.conf (forget all of the stuff you are told about going to the website root - I've tried and they don't work - parallels either ignored the new files or overwrote the changes).
After you open the file, scroll down to the line that defines the default ScriptAlias. It wil look something like this,
ScriptAlias /cgi-bin/ "/path/to/cgi-bin/"
What you want to do is add your own ScriptAlias below it that line, (keeping in mind that the name of the directory is mapped to each domain already and they have to be unique).
ScriptAlias /directory/cgi-bin/ "/path/to/your/custom/cgi-bin/"
Save the file, then restart httpd to commit the changes.
/etc/init.d/httpd restart
Next you want to make sure the folder itself and all files in it are chmod 755, because file in that directory will now be treated as executables and not documents.
If you find it's not working after this, you should enable multi in the host.conf file in the /etc/ directory (multi on).