본문 바로가기

Server/Apache

[Apache] Apache config 내의 ScriptAlias 지시어란?

Apache Module mod_alias

Available Languages:  en  |  fr  |  ja  |  ko  |  tr 

Description:Provides for mapping different parts of the host filesystem in the document tree and for URL redirection
Status:Base
Module Identifier:alias_module
Source File:mod_alias.c

Summary

The directives contained in this module allow for manipulation and control of URLs as requests arrive at the server. The Alias and ScriptAlias directives are used to map between URLs and filesystem paths. This allows for content which is not directly under the DocumentRoot served as part of the web document tree. 


ScriptAlias Directive

Description:Maps a URL to a filesystem location and designates the target as a CGI script
Syntax:ScriptAlias [URL-pathfile-path|directory-path
Context:server config, virtual host, directory
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.

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>


-  위의 내용처럼 Alias와 ScriptAlias는 같은 처리를 하나, mod_cig를 다루는 면에서 차아가 있다(나의 경우는  mod_cgi를 사용했기 때문에 ScriptAlias 사용)


원문 :

https://httpd.apache.org/docs/current/en/mod/mod_alias.html#scriptalias