MC_HTTPD (introduction to a self-compiled web Server)

Source: Internet
Author: User

Author: Yan wenze (robin)
Revision: 0.9

1. cd mc_httpd-x.x

2../configure -- mandir =/usr/share/man

3. make

4. su root
 
5. make install

6. take look at the configuration file in doc/mc_httpd.conf and modify it for your needs.

7. cp doc/mc_http.conf/etc/mc_httpd.conf

8. exit

Supported:

Supports GET, HEAD, POST, DELETE, and PUT.

Supports Accept, Accept-Charset, Accept-Encoding, Accept-Language, Host, If-Match, If-Modified-Since, If-None-Match, If-Range, Range, if-Unmodified-Since and User-Agent request header fields.

Supports Connection and Date general header fields.

Supports Etag, Location, and Server response header fields.

Supports Expires, Content-Encoding, Content-Length, Content-Location, Content-MD5, Content-Range, Last-Modified, and Content-Type entity header fields.

Supports cookie and status header fields.

Cgi/1.1 is supported.

Supports virtual hosts.

Supports resumable download.

Supports resumable upload. (Note: The value of content-length must follow the example in HTTP/1.1)

Supports Multi-line header field.

Not supported:

The server cannot be used as a proxy server.

The server does not support video and audio.

Command line parameters:

Note: the priority of the command line parameter is higher than that of the configuration file. The command line parameters cannot be re-specified during restart. Therefore, except for the-4,-6, and-f options, other parameters are not recommended.

-4: the server process runs on ipv4.

-6: server processes run in ipv6.

NOTE: If neither-4 nor-6 is specified, the specific Protocol is selected by the server process. For example, ipvtu12.04 selects ipv4 by default, and freebsd9.1 selects ipv6 by default.

-C: the server process tests the user's environment and configuration file, and then outputs the test result. The server does not actually work.

-X: Debugging options. This version does not work.

-V: the version of the output server. The server does not actually work.

-D: Specify the root directory of the server. For example, the-d/home/nns server process runs in the root directory of/home/nns (that is, execute the chroot (/home/nns/) operation ).

-F: Specifies the path of the configuration file (must be an absolute path ). The default configuration file path is/etc/mc_httpd.conf.

-U: indicates the uid of the server process. Both the user name and user ID are acceptable parameters, and the server will convert them by itself.

-G: Specify the gid of the server process. The group name and group id are acceptable parameters, and the server will convert them by itself.

-P: Specifies the port number.

Configuration File parameters:

Note: Modification of parameters in the configuration file takes effect after restart. The source code doc directory contains the mc_httpd.conf template. You can modify the file and copy it to the/etc directory.

Rootpath: Specify the root directory of the server. For example, the rootpath "/home/nns" server process runs in the root directory of/home/nns (that is, execute the chroot (/home/nns/) operation ).

Cgitimelimit: the running time limit of the cgi program. This version does not work.

Timelimit: This version does not work.

Maxrequests: This version does not work.

Maxinterval: maximum time limit between two requests connected to the same link.

Port: Specifies the port number.

Backlog: specify the value of backlog in the listen function.

Dirset: 0 indicates that the directory is not displayed. If the value is not 0, the directory is displayed.

Putset: 0 indicates that the put method is disabled on the server. If it is not 0, the put method is allowed on the server.

Deleteset: 0 indicates that the delete method is disabled on the server, and non-0 indicates that the server allows the delete method.

Mdaset: 0 indicates that the server disables sending the Content-MD5 header domain, and a non-0 indicates that the server sends the Content-MD5 header domain by default.

Etagset: 0 indicates that the server prohibits sending the ETAG header domain. If the value is not 0, the server allows sending the ETAG header domain.

Defaulttype: this value is used when the server cannot identify the file type.

Defaultcharset: the character set used by the server.

User: uid of the server process. Both the user name and user ID are acceptable parameters, and the server will convert them by itself.

Group: Specify the gid of the server process. The group name and group id are all acceptable parameters, and the server will convert them by itself.

Tmppath: path for storing temporary files on the server. For example, before and after tmpath "/tmp/", "/tmp/", you can add or not add it. The program will process it by itself. In this example, the temporary directory is actually/home/nns/tmp (if rootpath is/home/nns ).

Logfile: the path of the server log file (absolute path ). Users should regularly view and clean up the content of the file.

Pidfile: the file on which the server stores the server process id.

Hosts: Server Virtual Host settings. The specific format is as follows:

    }

 

Indexnames: the default page that the server will process. For example, the hosts of a server is

}

Indexnames is

    | }     

When the server receives the nnsmgsone.com request, it will view the existence of index.html and index. xhtm in the/home/nns/wwwdirectory and then send the page to the browser. (Assuming that the rootpath is/home/nns)

Cgipaths: All files in the cgipaths directory are treated as cgi programs. For example:

    | }        

The program treats all the files in the/home/nns/cgi-bin directory and/home/nns/cgi Directory as cgi programs. (Assuming that the rootpath is/home/nns)

Errpage: error page of the specified program. For example:

}

 

If the server cannot find a page, it will reply/home/nns/www/404.html to the browser.

Assume that the rootpath is/home/nns/, and the hosts is

}

 

Mimeencoding: Specify mime encoding.

Mimetype: Specify the mime type.

Signal:

SIGTGERM: a gentle killing process.

SIGHUP: restart the server process.

Cgi program:

To run a cgi program, the rootpath directory must have all environments for running the program. Example (assuming that rootpath is/home/nns): If you want to run a shell file,/home/nns/bin/sh is required (other files may be required ), if you want to run a perl program,/home/nns/bin/perl and/home/nns/lib/libperl. so is required.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.