Add new URL for CGI in Apache
来源:互联网 发布:华为交换机实现mac绑定 编辑:程序博客网 时间:2024/05/29 12:29
There is a DocumentRoot tag in httpd.conf to let you change the directory for your files. However, you can set up a new directory outside of your DocumentRoot directory for your specific purpose. Why? This can provide as little information as possible to the outside of world. The less a hacker knows about where your programs are physically located, the less harm that person can do.
First, you create a directory outside your DocumentRoot directory. For example, /var/myexample.
Second, create a alias for your directory, you can use the Alias for your common directories or ScriptAlias for your CGI program directories:
ScriptAlias /cgi-bib/ “/var/myexample/cgi/” or
Alias /jsp/ “/var/myexample/jsp/”
If you are setting up the directory support virtual site, add the Alias or ScriptAlias in the <VirtualHost…> container that defines the host.
<VirtualHost 10.26.24.3>
ServerName new.domain.com
DocumentRoot /var/www/html
Alias /jsp/ “/var/myexample/jsp/”
</VirtualHost>
Third, create a <Directory> container for that directory.
<Directory “/var/myexample/jsp/”>
Options ExecCGI -Indexes
AddHandler cgi-script .pl
</Directory>
The Options directive sets two options for the “/var/myexample/jsp/” directoyr. First, the ExecCGI is set, which tells apache to permit CGI program execution from within this directory. Second, the –Indexes tells apache that don’t list the files and directories under this directory, since because it is not a good idea to allow visitors to see the contents of your CGI script directory. Next, the AddHandler directive sets the cgi-script handler for a list of file extensions found in this directory. Any file with the named extension in the list is treated as a CGI program.
If you have virtual site, you can add these in the <VirtualHost…> directive:
<VirtualHost 10.26.24.3>
ServerName new.domain.com
DocumentRoot /var/www/html
Alias /jsp/ “/var/myexample/jsp/”
<Directory “/var/myexample/jsp/”>
Options ExecCGI -Indexes
AddHandler cgi-script .pl
</Directory>
</VirtualHost>
Then, you can visit your Web Server by typing “ http://your-server-name/jsp/ “.
Note: You’d better take more attention for the slash “/” at the end of your alias name. Both of the original name and alias name, for example Alias /jsp/ “/var/myexample/jsp/”, should have slash (as show before) or don’t have the slash such as: Alias /jsp “/var/myexample/jsp”. Because, if you define your alias name as: Alias /jsp/ “/var/myexample/jsp”, when you type the URL “ http://localhost/jsp/index.html “ in your browser, the apache server will translate it to “/var/myexample/jspindex.html” instead of “/var/myexample/jsp/index.html”.
- Add new URL for CGI in Apache
- add new service in framworks
- How to add a new "CustomAction" in ECB for a specific list
- Apache + CGI + C/C++ For Windows
- add domain in apache in linux system
- cannot add new member in VC++
- How to add new partition in centos
- Add new disk via LVM in linux
- ADD a new USERID in mainframe system
- Using shell scripts for CGI in lighttpd
- Apache URL ReWrite in Windows
- linux+apache+c cgi总结4表单URL处理
- Apache CGI
- How to add a new user in linux and add it to a new group
- Add SVN plug-in for Carbide C++
- Add new rows to WebCombo in client-side javascript
- How to add a new keycode in android
- How to add a new keycode in android
- hibernate中的一些概念
- 系统分析师教材
- Qte中文显示
- 金额大小写转换的asp完全无错版本
- ASP.Net学习之常用SQL存储过程
- Add new URL for CGI in Apache
- 企业应用架构模式 读书笔记 ZT
- 求一个数组中的最大次大数
- ASP.NET中的三种编译方法
- 奢侈品
- 关于"equals" &" =="异同
- 程序员每天该做的事
- VMware5.5.3 + Ubuntu6.10 + Apache2.2.3的注意事项,疑似VMware的BUG!
- 原来汉语的思路更接近计算机语言