国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Apache > 正文

分析Apache 與linux系統中配置

2024-08-27 18:21:58
字體:
來源:轉載
供稿:網友

1.備份Apache服務的主配置文件

[root@KCentOS5C ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup

2.linux系統中配置Apache服務的主配置文件

[root@KCentOS5C ~]# vi /etc/httpd/conf/httpd.conf

這里主要改動以下這些參數:

ServerName *:80

配置Apache的服務器名,如果有域名的話請填寫正確的服務器名。

Include conf.d/*.conf (/etc/httpd/conf.d)

確認Apache擴展配置文件的存放路徑。

3.查看Nagios網頁配置模板文件

  1. [root@KCentOS5C ~]# less nagios-2.9/sample-config/httpd.conf 
  2.   # SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER 
  3.   # Last Modified: 11-26-2005 
  4.   # 
  5.   # This file contains examples of entries that need 
  6.   # to be incorporated into your Apache web server 
  7.   # configuration file. Customize the paths, etc. as 
  8.   # needed to fit your system. 
  9.   #setting for nagios 
  10.   ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" ###設定了Nagios的CGI執行目錄對應的系統路徑。 
  11.   # SSLRequireSSL 
  12.   Options ExecCGI 
  13.   AllowOverride None 
  14.   Order allow,deny 
  15.   Allow from all 
  16.   # Order deny,allow 
  17.   # Deny from all 
  18.   # Allow from 127.0.0.1 
  19.   AuthName "Nagios Access" 
  20.   AuthType Basic 
  21.   AuthUserFile /usr/local/nagios/etc/htpasswd.user ###這里指定了訪問用戶帳戶庫文件。 
  22.   Require valid-user 
  23.   Alias /nagios "/usr/local/nagios/share" ###設定了Nagios的網頁URL對應的系統路徑。 
  24.   # SSLRequireSSL 
  25.   Options None 
  26.   AllowOverride None 
  27.   Order allow,deny 
  28.   Allow from all 
  29.   # Order deny,allow 
  30.   # Deny from all 
  31.   # Allow from 127.0.0.1 
  32.   AuthName "Nagios Access" 
  33.   AuthType Basic 
  34.   AuthUserFile /usr/local/nagios/etc/htpasswd.user ###這里指定了訪問用戶帳戶庫文件 
  35.   Require valid-user 
  36.   {######將#setting for nagios --這一段加到/usr/local/apache/conf/httpd.conf的末尾。 
  37.   用/usr/local/apache/bin/apachctl configtest 檢測配置 --help查看##########} 

基本上這個文件可以直接使用。根據這個配置文件中指定的AuthUserFile項,它指定的是通過Apache訪問Nagios的合法用戶的帳戶名單庫文件,需要使用htpasswd命令對這個名單庫進行用戶的添加。而默認安裝環境下在/usr/local/nagios/etc/目錄下是沒有htpasswd.user這個文件的,所以需要手動添加。請特別注意,用root身份建立的htpasswd.user文件的權限問題,應該在建立該文件完畢后立即更改為nagios用戶nagios組的所有權,并且要增加Nagios同組用戶讀寫權限。

4.整合Nagios網頁配置文件到Apache中

將Nagios網頁配置文件作為Apache的擴展配置文件復制改名到Apache的擴展配置文件目錄/etc/httpd/conf.d/目錄下

[root@KCentOS5C ~]# cp nagios-2.9/sample-config/httpd.conf /etc/httpd/conf.d/nagios-httpd.conf

5.建立Nagios的網頁訪問用戶帳戶文件(這里必須要與Nagios網頁配置文件當中AuthUserFile指定的路徑文件名一致)

[root@KCentOS5C ~]# touch /usr/local/nagios/etc/htpasswd.user

6.更改Nagios網頁訪問用戶帳戶文件的屬主

[root@KCentOS5C ~]# chown nagios.nagios /usr/local/nagios/etc/htpasswd.user

7.對Nagios網頁訪問用戶帳戶文件增加同組成員讀寫權限(這主要是賦給apache這個系統用戶)

[root@KCentOS5C ~]# chmod g+wr /usr/local/nagios/etc/htpasswd.user

8.察看Nagios網頁訪問用戶帳戶文件的屬性信息

[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用戶

我添加了一個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.

添加一個MD5口令加密的新用戶。

◆-d Force CRYPT encryption of the password (default).

◆-p Do not encrypt the password (plaintext).

添加一個口令不加密的新用戶。

◆-s Force SHA encryption of the password.

添加一個SHA口令加密的新用戶。

◆-b Use the password from the command line rather than prompting for it.

◆-D Delete the specified user.

刪除一個指定的用戶

On Windows, NetWare and TPF systems the '-m' flag is used by default.

在Windows、NetWare以及TPF這些操作系統中“-m”參數(啟用MD5對口令加密)是默認使用的

On all other systems, the '-p' flag will probably not work.

在其他的所有操作系統中“-p”(不對口令啟用加密)參數將可能會引起失敗。

11.檢查htpasswd帳戶文件

[root@KCentOS5C ~]# cat /usr/local/nagios/etc/htpasswd.user

kanecruise:$apr1$Qwk9h/..$HaRakpabADGZL10dwPcrx1

用戶添加正確,并且口令都以MD5的方式加密了。

以上講解的是在linux系統中配置Apache服務。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 敦化市| 乐业县| 扬中市| 灵川县| 凤山市| 仁布县| 绥化市| 米易县| 河津市| 兴山县| 茶陵县| 云安县| 墨江| 葵青区| 江源县| 孟州市| 淮滨县| 阜阳市| 巴林左旗| 鲁山县| 大足县| 永嘉县| 华池县| 德清县| 泉州市| 河池市| 金川县| 和静县| 黑龙江省| 讷河市| 本溪| 沐川县| 天门市| 怀柔区| 桂东县| 大田县| 渝北区| 淮安市| 汤阴县| 台前县| 南雄市|