Назад | Перейти на главную страницу

Centos 5.5 - запускайте cgi-скрипты из разных мест

Я хочу иметь возможность запускать сценарии cgi из других мест, кроме / var / www / cgi-bin, примеры:

/var/www/folder1/cgi-bin
/var/www/folder2/cgi-bin
/var/www/folder3/cgi-bin

Как мне настроить сервер для этого?

РЕДАКТИРОВАТЬ: это для запуска сценариев cgi с веб-сайта на моем лично размещенном веб-сервере.

Это можно сделать двумя способами:

1) Настройте виртуальные хосты и под каждым виртуальным хостом укажите ScriptAlias /cgi-bin/ "/your/location"

2) Создайте подпапки в /var/www/cgi-bin и используйте подпапки для ссылки на них, однако с помощью этого метода вы не можете оставить /var/www/cgi-bin дерево каталогов.

ScriptAlias ​​- ваш дядя.

Из: http://httpd.apache.org/docs/2.2/mod/mod_alias.html#scriptalias

Description:    Maps a URL to a filesystem location and designates the target as a CGI script
Syntax: ScriptAlias URL-path file-path|directory-path
Context:    server config, virtual host
Status: Base
Module: mod_alias

The ScriptAlias directive has the same behavior as the Alias directive, except that in addition it marks the target directory as containing CGI scripts that will be processed by mod_cgi's cgi-script handler. URLs with a case-sensitive (%-decoded) path beginning with URL-path will be mapped to scripts beginning with the second argument, which is a full pathname in the local filesystem.
Example:

ScriptAlias /cgi-bin/ /web/cgi-bin/

A request for http://example.com/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo. This configuration is essentially equivalent to:

Alias /cgi-bin/ /web/cgi-bin/
<Location /cgi-bin >
SetHandler cgi-script
Options +ExecCGI
</Location>