Apache Compilation Installation Article
-
Install Apache to install the following several packages, Apr apr-util,pcre, of course, these packages can also be used by the system itself comes with the package, but here we compile and install these several packages.
2. Download and install APR,
Put the files in the/USR/LOCAL/SRC directory,
TAR-ZXVF apr-1.5.2.tar.gz
CD apr-1.5.2
./configure--prefix=/usr/local/apr/
Make
Make install
3. Download and install
Apr-utils
TAR-ZXVF apr-util-1.5.4.tar.gz
CD apr-util-1.5.4
./configure--prefix=/usr/local/apr-util/--with-apr=/usr/local/apr/#这里配置的时候要制定apr的安装路径.
Make
Make install
4. Installing pcre
TAR-ZXVF Pcre
CD Pcre
./configure--prefix=/usr/local/pcre
Make && make install
5. Install Apache here the installed version is 2.4.18, compare the new version
TAR-ZXVF httpd-2.4.18.tar.gz
CD httpd-2.4.18
./configure--with-apr=/usr/local/apr/--with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre/
Make
Make install
6. General installation will have the following several directories
Bin build Cgi-bin conf error htdocs icons include logs man manual modules
7. Modify the configuration file
Vim/usr/local/apache2/conf/httpd.conf
Locate the following line and change the listening port to the local 80
#ServerName www.example.com:80
ServerName localhost:80
8. Launch Apache
/usr/local/apache2/bin/apachectl-k start
9. View the process
Ps-ef|grep httpd
Root 28310 1 0 10:11? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28311 28310 0 10:11? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28312 28310 0 10:11? 00:00:00/usr/local/apache2/bin/httpd-k start
Daemon 28313 28310 0 10:11? 00:00:00/usr/local/apache2/bin/httpd-k start
Root 28420 4860 0 10:11 pts/1 00:00:00 grep httpd
10. View Ports
[Email protected] bin]# Netstat-tunlp|grep httpd
TCP 0 0::: +:::* LISTEN 28310/httpd
Compiling and installing PHP
The version we installed here is 5.6.11,
TAR-JXVF php-5.6.11.tar.bz2
CD php-5.6.11
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs
Make && make install
Do Nagios front-end display article
-
Configure Apache to support Nagios, modify/usr/local/apache2/conf/httpd.conf files
Put User Deamon
Group Deamon
Switch
User Nagios
Group Nagios
and then find
< Ifmodule Dir_module >
DirectoryIndex index.html
</ Ifmodule >
Revision changed to
< Ifmodule Dir_module >
DirectoryIndex index.html index.php
AddType application/x-httpd-php. php
</ Ifmodule >
Then find the module item and remove the following module option annotations.
LoadModule Cgid_module modules/mod_cgid.so
LoadModule Actions_module modules/mod_actions.so
For security reasons, it is generally necessary for Nagios's web monitoring pages to be authorized for access, which requires an additional authentication configuration, i.e. the following information is added at the end of the httpd.conf file:
Scriptalias/nagios/cgi-bin "/usr/local/nagios/sbin" #nagiosCGI脚本位置
<directory "/usr/local/nagios/sbin" >
# Sslrequiressl
Options execcgi
AllowOverride None
Require all granted
# Order Deny,allow
# Allow from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
Authuserfile/usr/local/nagios/etc/htpasswd.users#nagios User Authentication File
Require Valid-user
</Directory>
Alias/nagios "/usr/local/nagios/share" #访问网页文件路径别名
<directory "/usr/local/nagios/share" >
# Sslrequiressl
Options None
AllowOverride None
Require all granted
# Order Allow,deny
# Allow from all
# Order Deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
Authuserfile/usr/local/nagios/etc/htpasswd.users
Require Valid-user
</Directory>
2. create Apache directory validation files
In the above configuration, the directory validation file htpasswd is specified, and the following is the file to be created:
/usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
New Password:
Re-type New Password:
Adding Password for user nagiosadmin
3. Close and restart Apache
Pkill httpd
/usr/local/apache2/bin/apachectl-k start
Launch Apache, 403 deny access, this is 2.4* 's version
To change the configuration file in httpd.conf
Put
<directory/>
allowoverride None
Require all denied
</Directory>
Switch
<directory/>
allowoverride None
Require all granted
</Directory>
Restart Apache
Nagios Display Results:
Open it
http://172.30.65.169/nagios/page, enter the Nagios authenticated user name Nagiosadmin, and the password you just set
The page will appear as shown
650) this.width=650; "title=" 15.png "src=" http://s4.51cto.com/wyfs02/M01/7D/33/wKiom1biN7SQVCcQAAI1MtLLlsA402.png "alt=" Wkiom1bin7sqvccqaai1mtlllsa402.png "/>
This article is from the Server Ops blog, so be sure to keep this source http://shamereedwine.blog.51cto.com/5476890/1749865
Apache compile and install and do Nagios front end display