The httpd server installed with yuminstallhttpd * is under the etchttpd directory by default, but the project path is under varwwwhtml by default. in the conf configuration file, check that if httpd is downloaded from the Internet for installation, it is different. If you need to start it, you cannot use servicehttpdstart. You need to go to the apac directory
Use yum installHttpd* The installed httpd server is under the/etc/httpd directory by default.
However, the project path is under/var/www/html by default, which can be viewed in the httpd. conf configuration file.
If you download httpd from the Internet for installation, it is different. If you need to start it, you cannot use service httpd start.
You need to go to the/apache2/bin/httpd directory. In this way, you can start
Install apacheCompression
Place the downloaded package under/usr/local/src and use tar zxvf httpd-NN.tar.gzExtract,
CdHttpd-NN
./Configure -- prefix =/usr/local/httpd
Make
Make install
Now you find that there is an extra httpd directory under/usr/local.
We can use/usr/local/httpd/bin/Apachectl-K start | stop | restart to manage httpd services.
To start with the system, add a line at the end of the/etc/rc. d/init. d/rc. local file:
/Usr/local/httpd/bin/apachectl-k start
Even so, we still cannot manage the httpd service. Can we use the service to manage the httpd service like rpm installation?
The answer is yes. We must do the following:
Create an httpd file under/etc/rc. d/init. d/and useChmod755 httpd makes it executable.
Add the following content to vi httpd:
- #! /Bin/bash
- #
- # Httpd Startup script for the Apache HTTP Server
- #
- #Chkconfig:-85 15
- # Description: Apache is a World WIdE Web server. It is usEdTo serve
- # HTMLFileS and CGI.
- # Processname: httpd
- # Config:/etc/httpd/conf/httpd. conf
- # Config:/etc/sysconfig/httpd
- # PiDfIle:/var/run/httpd. pid
- # Source fuNcTion library.
- ./Etc/rc. d/init. d/functions
- If [-f/etc/sysconfig/httpd]; then
- ./Etc/sysconfig/httpd
- Fi
- # Start httpd in the C locale by default.
- HTTPD_LANG={ {HTTPD_LANG-\ "C \"}
- # This will prevent initlog from sWallOwing up a pass-phrase prompt if
- # Mod_ssl needs a pass-phrase from the user.
- INITLOG_ARGS=\"\"
- # SetHTTPD=/Usr/sbin/httpd. worker in/etc/sysconfig/httpd to use a server
- # With the thread-baSed\ "Worker \" MPM; be warned that some moDuLes may not
- # Work correctly with a thread-based MPM; notablyPHPWill refuse to start.
- # Path to the apachectl script, server binary, and short-foRmFor messages.
- Apachectl=/Usr/sbin/apachectl
- Httpd={ {HTTPD-/usr/sbin/httpd}
- Prog=Httpd
- Pidfile=$ {PIDFILE-/var/run/httpd. pid}
- Lockfile={ {LOCKFILE-/var/lock/SuBsys/httpd}
- RETVAL=0
- # Check for 1.3 configuration
- Check13 (){
- CONFFILE=/Etc/httpd/conf/httpd. conf
- GONE=\ "(ServerType | BindADdRess | Port | AddModule | ClearModuleList | \"
- GONE=\ "$ {GONE} AgentLog | RefererLog | RefererIgnore | FancyIndExIng | \"
- GONE=\ "$ {GONE} AccessConfig | ResourceConfig )\"
- IfLANG=C Grep-Eiq \ "^ [[: space:] * ($ GONE) \" $ CONFFILE; then
- Echo
- Echo 1>& 2 \ "Apache 1.3 configuration ctictives found \"
- Echo 1>& 2 \ "please read/usr/share/doc/httpd-2.2.3/migration.html \"
- Failure \ "Apache 1.3 config directives test \"
- Echo
- Exit 1
- Fi
- }
- # The semantics of these two functionsDiffEr from the way apachectl does
- # Things -- attempting to start while running is a failure, and shutdown
- # When not running isLsO a failure. So we just do it the way init scripts
- # Are expected to behave here.
- Start (){
- Echo-n {1} quot; Starting $ prog :\"
- Check13 | exit 1
- LANG= $ HTTPD_LANG daemon $ httpd $ OPTIONS
- RETVAL= $?
- Echo
- [$RETVAL=0] &Touch$ {Lockfile}
- Return $ RETVAL