How is Apache started if Listen is defined in the configuration file as the default 80-port (or other ports below), then 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 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 at startup If the apache creates a fatal error during the startup process, it will display the information describing the 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: I want to start the service by a privileged port, but there is no additional Apache instance that has been logged in with a root user, or when the service has been launched. The same port is bound to the same port. For more solutions to the solution, see the Apache's FAQ. With the system starts if you want your server to remain in the system after the system is restarted, you should add HTTPD or APACHECTL calls to your system boot file (typical file is Rc.local or Rc.n directory. file). 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. I use the server to be the freebsd system, so in FreeBSD, start Apache, which is usually established in /usr/local/tc/rc.d/, and the content is as follows:
Code: #! / Bin / sh ### filename = apache.sh ### Author = honestqiao prefix = / usr / local / apache2 case "$ 1" in start "[" SSL "=" ssl "-a -f" $ Prefix / etc / apache2 / ssl.crt / server.crt "] && SSL = SSL [-x $ {prefix} / sbin / apachectl] && $ {prefix} / sbin / apachectl start $ {ssl}> / dev / Null && echo -n 'apache2' ;; stop) [-r /var/run/httpd.pid] && $ {prefix} / sbin / apachectl stop> / dev / null && echo -n 'apache2' ;; *) Echo "USAGE:` BaseName $ 0` {start | stop}> & 2 ;; esac exit 0 Of course, you can also set up Apache in rc.local, add it in rc.local
Code: ### Apache / usr / local / apache2 / bin / apachectl start