How to start HTTPD service?

xiaoxiao2021-04-10  342

Start Apache

In the Windows operating system, Apache is usually run in Windows NT, and under Windows 95 is running in a console program. For details, see Run Apache under Windows.

In the UNIX operating system, the HTTPD program runs as a daemon and processes the request in the background. This document describes how to call HTTPD.

How does Apache started when starting? Events occurring with the system start additional information

How is Apache started?

If Listen is defined in the configuration file as the default 80-port (or other ports below), start Apache will require root permissions to bind it on this privileged port. Once the server starts to start and complete some operations such as opening the log file, it will create a lot of child processes to do some work such as listening and responding to client requests. The HTTPD main process still runs with ROOT users, and its sub-process will run with a lower permissions. This will be controlled by the multi-channel processing module you selected.

The recommended method for starting the HTTPD execution file is to use the ApachectL to control the script. This script sets the environment variables necessary to run HTTPD in some operating systems. ApachectL will pass all parameters of the command line, so all HTTPD options can also be used for ApachectL. You can directly modify the ApachectL script, change the HTTPD variable of the head to point to the correct position of the HTTPD file, or set any command line parameters to make it always valid.

The first thing to do after HTTPD is called is to find and read the configuration file httpd.conf. The location of this file is set at compile, but it can also be specified using the -f command line option in the runtime:

/ usr / local / apache / bin / httpd -f /usr/local/apache/conf/httpd.conf

If everything is normal, the server will separate the terminal and almost simultaneously with the terminal. This means that the server has started and started. Then you can connect your server with your browser to view the local copy of the test documentation in the Document directory and other documents in its page link.

An error occurred during startup

If Apache generates a fatal error during the startup process, it will display the information describing this error before exiting or written to ErrorLog. A most frequently generated error message is "Unable to Bind TO Port ...". This information is mainly caused by the following reasons:

Want to start the service by a privileged port but does not log in with a root user, or an additional Apache instance has another Apache instance in the run or other web server has been bound to the same port.

For more solutions to the solution, see the Apache's FAQ.

Start with the system

If you want your server to remain in the system after the system is restarted, you should add HTTPD or ApachectL to your system boot file (typical file is a file in rc.local or rc.n directory). This will start Apache with root privileges. Of course, before this, you must ensure that your server has completed the settings of security and access.

The ApachectL script is designed to be used as a SYSV initialization script, which accepts Start, Restart, and STOP parameters, and translates them into HTTPD corresponding signals, so you can usually connect ApachectL to the appropriate initial directory, but you need to check your system. Accurate requirements for this.

extra information

For HTTPD and Apachectl, and other relevant support programs, please refer to the server and support program page. It also includes all documents for all modules published with the apache distribution package and the instructions thereof.

转载请注明原文地址:https://www.9cbs.com/read-133374.html

New Post(0)