本文最后更新于:2020年5月8日 下午
Ubuntu 部署 Smokeping 监控软件
1.安装smokeping软件
sudo apt-get install smokeping -y
2.编辑smokeping配置文件,不发送报警邮件。如有需要,可以后续添加。
sudo vi /etc/smokeping/config.d/pathnames
#注释掉这行
#sendmail = /usr/sbin/sendmail
#编辑 General 修改your-ip为服务器IP
sudo vi /etc/smokeping/config.d/General
cgiurl = http://your-ip/cgi-bin/smokeping.cgi
3.编辑apache配置文件。
sudo vim /etc/apache2/conf-available/serve-cgi-bin.conf
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
ScriptAlias /smokeping/smokeping.cgi /usr/lib/cgi-bin/smokeping.cgi
Alias /smokeping /usr/share/smokeping/www
<Directory “/usr/share/smokeping/www”>
Options FollowSymLinks
</Directory>
</IfDefine>
</IfModule>
#vim: syntax=apache ts=4 sw=4 sts=4 sr noet
4.重启cgi,apache,smokeping
sudo a2enmod cgi
sudo service apache2 restart
sudo service smokeping restart
后记
排错指南:
一. 当apache2重启提示:
* Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name,
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
解决的问题是:
sudo vi /etc/apache2/sites-available/default
#打开default文件后,在default文件顶端加入:
ServerName 127.0.0.1
#重启apache2 就不会提示上述错误了
二. 修改apache2的默认端口,默认网站目录和默认主页文档
1. 修改 /etc/apache2/ports.conf 将
NameVirtualHost *:80
Listen 80
改为自己需要的端口
NameVirtualHost *:9000
Listen 9000
2,修改/etc/apache2/sites-available/default 将第一行的
<VirtualHost *:80> 改为自己需要的端口 <VirtualHost *:9000>
3,修改 /etc/init.d/apache2/httpd.conf 添加
Servername localhost
否则重启时会报如下错误
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
4,重启apache
sudo /etc/init.d/apache2 restart
端口修改完毕。apache的端口修改为9000了。
###########################################
修改默认网站目录:
/etc/apache2/sites-available/default
将/var/www 修改位你的路径: /var/www/GMG/
修改默认主页文档:
/etc/apache2/mods-available/dir.conf
将 index.* 替换为 xxx.*
不过随apache2的版本不同 文件的放置位置不一样
输入这个命令 grep -iR DirectoryIndex /etc/apache2
查看 DirectoryIndex 在apache2哪个文件里面。
本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!