Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make Apache support cgi, SSI and shtml

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to make Apache support cgi, SSI and shtml". In daily operation, I believe many people have doubts about how to make Apache support cgi, SSI and shtml. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "how to make Apache support cgi, SSI and shtml"! Next, please follow the editor to study!

1. First of all, it is clear that you can only specify a certain directory and support cgi, that is, run that directory to execute cgi programs; otherwise, it is not very safe.

Look for:

The copy code is as follows:

#

# "c:/program files/apache group/apache/cgi-bin" should be changed to whatever your scriptaliased

# cgi directory exists, if you have that configured.

#

Allowoverride all

Options all

Order allow,deny

Allow from all

Set directory to the directory where cgi can be executed

two。

Look for:

The copy code is as follows:

#

# scriptalias: this controls which directories contain server scripts.

# scriptaliases are essentially the same as aliases, except that

# documents in the realname directory are treated as applications and

# run by the server when requested rather than as documents sent to the client.

# the same rules about trailing "/" apply to scriptalias directives as to

# alias.

#

Scriptalias / cgi-bin/ "e:/website_field/cgi"

Change the following directory to the same as the one above.

3.

Set the suffix of the cgi script and look for:

The copy code is as follows:

#

# addhandler allows you to map certain file extensions to "handlers"

# actions unrelated to filetype. These can be either built into the server

# or added with the action command (see below)

#

# if you want to use server side includes, or cgi outside

# scriptaliased directories, uncomment the following lines.

#

# to use cgi scripts:

#

Addhandler cgi-script .cgi .pl

Set suffixes such as .cgi, .pl, etc., whatever you can think of, but avoid using existing suffixes such as .html, .asp, .php, etc.

Note: after setting up a directory that supports cgi, the contents of that directory and subdirectories can be executed.

Configure apache to support ssi, that is, server-side parsed server-parsed html (shtml)

For more information about what is ssi and what is shtml, please refer to the other two articles on this site.

You can use ssi to dynamically embed html content, you can return results for ssi commands or even the system, and more commonly used perl programs (especially the cgi of perl).

1. Configure apache:

1) first find:

The copy code is as follows:

#

# to use server-parsed html files

#

Addtype text/html .shtml

Addhandler server-parsed .shtml

Get rid of the # before the last two lines

2) at the same time, you need to specify which directory supports this resolution, and look for:

The copy code is as follows:

#

# "c:/program files/apache group/apache/cgi-bin" should be changed to whatever your scriptaliased

# cgi directory exists, if you have that configured.

#

Allowoverride all

Options all

Order allow,deny

Allow from all

Make changes starting with directory:

First, specify to your own directory, here is "e:/website_field/shtml"

Then set the options as above:

The copy code is as follows:

Allowoverride all

Options all

Order allow,deny

Allow from all

Restart apache after that should be fine.

two。 For the ssi directives supported by apache, please refer to the following introduction:

3. An example of a shtml page that uses ssi:

1), index.shtml

The copy code is as follows:

Shtml

This file last modified

Today is

2), embed.html

The copy code is as follows:

Embed html

This is the content from embed.html

3), test.pl

The copy code is as follows:

#! C:\ perl\ bin\ perl-w

Use strict

Sub print_header ()

{

Print "this is header function!"

}

Sub print_footer ()

{

Print "this is footer function!"

}

Print_header ()

Print_footer ()

At this point, the study on "how to make Apache support cgi, SSI and shtml" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report