Briefly use linux to build www server (3)

  




First configure the /etc/services file, it is a database file, recorded All known service information for the Internet, each line in the file represents a service. The specific content contained in the line is as follows (the space is separated by a space or a tab):

The official service name port number Protocol name service alias

Note: The first 1024 ports of TCP/IP Reserved by the system, reserved ports can only be used by system processes or root processes. When running the server in the default standalone mode, the portnumber should be set to 80. However, when running the server in inetd mode, it should be set to 8080.

Then the /etc/inetd.conf file is configured. The meaning of each line in the /etc/inetd.conf file is as follows:
Service Name Socket Type Protocol Waiting /Not Waiting Run the service program's user ID
server program's parameters

(2). Running for the first time

Before running the server for the first time, you should include a file called index.html in the htdocs directory. Fortunately, this file is already included in the Apache standard distribution.
Now you can manually start httpd with the following command, run the server in the default standalone mode:

# /sbin/httpd -f /etc/httpd/conf/httpd .conf

Note: This is to be run as root, otherwise the TCP/IP port will not be bound to port 80, and the UID and GID cannot be changed to the settings specified in the configuration file. .
If you want to run the server as inetd, then you don't need to do anything else, because the system has already started it when it starts, and when inetd receives the http request, it will automatically start httpd.

(3). Server Debugging

Two typical error messages are given here for reference only.
Httpd: Could not open document config file ... ...
Fopen: No such file or directory.
Cause: The file path is incorrect. Because Apache does not look for a configuration file in the current directory when it starts.
Httpd:bad user name ... ...
Httpd:bad group name ... ...
Cause: The user or group set in the configuration file httpd.conf does not actually exist.

Copyright © Windows knowledge All Rights Reserved