How to install apache and make the working mode work
How do I install apache and make the working mode work? This problem may be often seen in our daily work. Through this question, I hope you can gain more. Here are the steps to solve this problem.
I. View of apache mode
If apache is already installed, we can use the httpd-l command to view the current mode (there is only one possible). If we find prefork.c, we are currently working in prefork mode, while worker.c is working in worker mode.
If apache is not installed, we can add-- with-pem= (prefork | worker) when compiling.
Option determines which mode is enabled.
Of course, if you have installed it (the author's mode is prefork), you can also use the following command to switch
Mv httpd httpd.prefork
Mv httpd.worker httpd
After reboot, the mode will change.
Second, install apche
Because Apache depends on APR, APR-Util, and PCRE, you need to download:
APR + APR-Util: http://apr.apache.org/download.cgi
PCRE: http://sourceforge.net/projects/pcre/files/pcre/
1. Install apr
Tar zxvf apr-1.5.1.tar.gz (extract the file to the directory / home/gaoqing/software/apache)
. / configure--prefix=/home/gaoqing/software/apache/apr configuration installation directory
Make
Make install
2. Install apr-util
. / configure--prefix=/home/gaoqing/software/apache/apr-util-- with-apr=/home/gaoqing/software/apache/apr
Make & & make install
3. Install pcre
. / configure-- prefix=/home/gaoqing/software/apache/pcre
4. Install apache and specify the working mode as work
Download address: http://httpd.apache.org/
. / configure-prefix=/home/gaoqing/software/apache/apache-with-apr=/home/gaoqing/software/apache/apr-with-apr-util=/home/gaoqing/software/apache/apr-util-with-pcre=/home/gaoqing/software/apache/pcre-with-mpm=worker
Make & & make install
III. Configuration
Modify the configuration file, or there will be problems:
AH00558: httpd: Could notreliably determine the server's fully qualified domain name, using 127.0.1.1.Set the 'ServerName' directive globally to suppress this message
Solution: modify conf/httpd.conf to:
# ServerNamewww.example.com:80
Change to:
ServerNamelocalhost:80
IV: start, stop and restart apache services
Suppose your apahce installation directory is / usr/local/apache2, these methods are suitable for any situation
Apahce start command:
Recommended / usr/local/apache2/bin/apachectl start apaceh startup
Apache stop command
/ usr/local/apache2/bin/apachectl stop stop
Apache restart command:
/ usr/local/apache2/bin/apachectl restart restart
To restart the Apache server without interrupting the current connection, run:
/ usr/local/sbin/apachectl graceful
Service httpd start start
Service httpd restart restart
Servicehttpd stop out of service
On the compilation and installation of apache knowledge is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you like this article, you might as well share it for more people to see.