自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

高效分析linux系統(tǒng)中配置Apache服務(wù)

系統(tǒng) Linux
本文主要講解在linux系統(tǒng)中配置Apache服務(wù),其中包括檢查htpasswd帳戶文件,查看htpasswd的使用方法,建立Nagios的網(wǎng)頁訪問,備份Apache服務(wù)的主配置文等知識(shí)。

學(xué)習(xí)linux系統(tǒng)服務(wù)時(shí),你可能會(huì)遇到多種問題,這里將介紹在linux系統(tǒng)中配置Apache服務(wù)問題的解決方法,在這里拿出來和大家分享一下。

1.備份Apache服務(wù)的主配置文件
[root@KCentOS5C ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup
 
2.linux系統(tǒng)中配置Apache服務(wù)的主配置文件
[root@KCentOS5C ~]# vi /etc/httpd/conf/httpd.conf
這里主要改動(dòng)以下這些參數(shù):
ServerName *:80
配置Apache的服務(wù)器名,如果有域名的話請?zhí)顚懻_的服務(wù)器名。
Include conf.d/*.conf  (/etc/httpd/conf.d)
確認(rèn)Apache擴(kuò)展配置文件的存放路徑。

3.查看Nagios網(wǎng)頁配置模板文件
[root@KCentOS5C ~]# less nagios-2.9/sample-config/httpd.conf
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

#setting for nagios
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"  ###設(shè)定了Nagios的CGI執(zhí)行目錄對應(yīng)的系統(tǒng)路徑。

#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   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.user  ###這里指定了訪問用戶帳戶庫文件。
   Require valid-user

Alias /nagios "/usr/local/nagios/share"   ###設(shè)定了Nagios的網(wǎng)頁URL對應(yīng)的系統(tǒng)路徑。

#  SSLRequireSSL
   Options None
   AllowOverride None
   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.user   ###這里指定了訪問用戶帳戶庫文件
   Require valid-user

{######將#setting for nagios --這一段加到/usr/local/apache/conf/httpd.conf的末尾。
用/usr/local/apache/bin/apachctl configtest 檢測配置 --help查看##########}


基本上這個(gè)文件可以直接使用。根據(jù)這個(gè)配置文件中指定的AuthUserFile項(xiàng),它指定的是通過Apache訪問Nagios的合法用戶的帳戶名單庫文件,需要使用htpasswd命令對這個(gè)名單庫進(jìn)行用戶的添加。而默認(rèn)安裝環(huán)境下在/usr/local/nagios/etc/目錄下是沒有htpasswd.user這個(gè)文件的,所以需要手動(dòng)添加。請?zhí)貏e注意,用root身份建立的htpasswd.user文件的權(quán)限問題,應(yīng)該在建立該文件完畢后立即更改為nagios用戶nagios組的所有權(quán),并且要增加Nagios同組用戶讀寫權(quán)限。

4.整合Nagios網(wǎng)頁配置文件到Apache中
將Nagios網(wǎng)頁配置文件作為Apache的擴(kuò)展配置文件復(fù)制改名到Apache的擴(kuò)展配置文件目錄/etc/httpd/conf.d/目錄下
[root@KCentOS5C ~]# cp nagios-2.9/sample-config/httpd.conf /etc/httpd/conf.d/nagios-httpd.conf
 
5.建立Nagios的網(wǎng)頁訪問用戶帳戶文件(這里必須要與Nagios網(wǎng)頁配置文件當(dāng)中AuthUserFile指定的路徑文件名一致)
[root@KCentOS5C ~]# touch /usr/local/nagios/etc/htpasswd.user
 
6.更改Nagios網(wǎng)頁訪問用戶帳戶文件的屬主
[root@KCentOS5C ~]# chown nagios.nagios /usr/local/nagios/etc/htpasswd.user
 
7.對Nagios網(wǎng)頁訪問用戶帳戶文件增加同組成員讀寫權(quán)限(這主要是賦給apache這個(gè)系統(tǒng)用戶)
[root@KCentOS5C ~]# chmod g+wr /usr/local/nagios/etc/htpasswd.user
 
8.察看Nagios網(wǎng)頁訪問用戶帳戶文件的屬性信息
[root@KCentOS5C ~]# ll /usr/local/nagios/etc/htpasswd.user
-rw-rw-r-- 1 nagios nagios 0 Oct  5 14:05 /usr/local/nagios/etc/htpasswd.user
 
9.添加htpasswd.user用戶
我添加了一個(gè)kanecruise用戶,口令是123456。
[root@KCentOS5C ~]# htpasswd -m /usr/local/nagios/etc/htpasswd.user kanecruise

New password: 123456
Re-type new password: 123456
Adding password for user kanecruise

10.查看htpasswd的使用方法,這里我就解釋一些比較重要和常用的。
[root@KCentOS5C ~]# htpasswd

Usage:
        htpasswd [-cmdpsD] passwordfile username
        htpasswd -b[cmdpsD] passwordfile username password
        htpasswd -n[mdps] username
        htpasswd -nb[mdps] username password
 
◆-c  Create a new file.
     建立新的帳戶庫文件。
◆-n  Don't update file; display results on stdout.
◆-m  Force MD5 encryption of the password.
     添加一個(gè)MD5口令加密的新用戶。
◆-d  Force CRYPT encryption of the password (default).
◆-p  Do not encrypt the password (plaintext).
     添加一個(gè)口令不加密的新用戶。
◆-s  Force SHA encryption of the password.
     添加一個(gè)SHA口令加密的新用戶。
◆-b  Use the password from the command line rather than prompting for it.
◆-D  Delete the specified user.
     刪除一個(gè)指定的用戶
 
On Windows, NetWare and TPF systems the '-m' flag is used by default.
在Windows、NetWare以及TPF這些操作系統(tǒng)中“-m”參數(shù)(啟用MD5對口令加密)是默認(rèn)使用的
On all other systems, the '-p' flag will probably not work.
在其他的所有操作系統(tǒng)中“-p”(不對口令啟用加密)參數(shù)將可能會(huì)引起失敗。

11.檢查htpasswd帳戶文件
[root@KCentOS5C ~]# cat /usr/local/nagios/etc/htpasswd.user

kanecruise:$apr1$Qwk9h/..$HaRakpabADGZL10dwPcrx1

用戶添加正確,并且口令都以MD5的方式加密了。
以上講解的是在linux系統(tǒng)中配置Apache服務(wù)。

【編輯推薦】

  1. 深入講述linux Ext3文件系統(tǒng)
  2. linux vi編輯器之葵花寶典
  3. 快樂學(xué)習(xí)Linux虛擬機(jī)VMware
  4. linux問題解答之:linux Nautilus
  5. linux下殺死進(jìn)程全權(quán)講解
責(zé)任編輯:薛輩輩 來源: linux
相關(guān)推薦

2018-04-26 09:33:16

2009-11-25 10:13:30

SUSE Linux配

2009-11-25 10:18:25

linuxapache tomc虛擬主機(jī)

2024-05-07 08:16:17

2009-12-22 10:15:36

Linux Apach

2009-11-30 17:37:20

Linux Apach

2010-09-14 11:16:55

Debian Linu

2010-05-25 18:45:05

2018-04-02 15:07:01

LinuxApacheWeb服務(wù)器

2011-03-25 17:20:37

NagiosApache

2009-01-18 09:21:00

VMware網(wǎng)絡(luò)配置

2009-12-14 17:32:14

LILO配置

2009-06-14 18:46:34

紅旗LinuxLILO

2009-02-12 18:21:19

VMwareLinux虛擬化

2011-03-09 10:50:27

Linuxapachephp

2019-08-09 08:43:02

2011-02-15 10:55:50

LinuxApacheMysql

2010-01-14 15:56:29

2011-03-22 14:20:30

Nagios安裝

2011-01-07 09:25:35

LinuxDHCP服務(wù)器
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)