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

首頁 > 網(wǎng)站 > Apache > 正文

CentOS 7.2配置Apache服務httpd(上)

2024-08-27 18:23:45
字體:
供稿:網(wǎng)友
這篇文章主要為大家詳細介紹了CentOS 7.2配置Apache服務 httpd上篇,具有一定的參考價值,感興趣的小伙伴們可以參考一下

一、Apache簡介

Apache HTTP Server(簡稱Apache)是Apache軟件基金會的一個開放源代碼的網(wǎng)頁服務器軟件,可以在大多數(shù)電腦操作系統(tǒng)中運行,由于其跨平臺和安全性(盡管不斷有新的漏洞被發(fā)現(xiàn),但由于其開放源代碼的特點,漏洞總能被很快修補。因此總合來說,其安全性還是相當高的。)。被廣泛使用,是最流行的Web服務器軟件之一。它快速、可靠并且可通過簡單的API擴充,將Perl/Python等解釋器編譯到服務器中。

軟件圖標

二、安裝Apache httpd

安裝httpd以配置Web服務器, HTTP使用80 / TCP

[1] 安裝 httpd.[root@linuxprobe ~]# yum -y install httpd# 刪除默認歡迎頁面[root@linuxprobe ~]# rm -f /etc/httpd/conf.d/welcome.conf[2] 配置httpd,將服務器名稱替換為您自己的環(huán)境[root@linuxprobe ~]# vi /etc/httpd/conf/httpd.conf# line 86: 改變管理員的郵箱地址ServerAdmin root@linuxprobe.org# line 95: 改變域名信息ServerName www.linuxprobe.org:80# line 151: none變成AllAllowOverride All# line 164: 添加只能使用目錄名稱訪問的文件名DirectoryIndex index.html index.cgi index.php# add follows to the end# server's response header(安全性)ServerTokens Prod# keepalive is ONKeepAlive On[root@linuxprobe ~]# systemctl start httpd[root@linuxprobe ~]# systemctl enable httpd[3] 如果Firewalld正在運行,請允許HTTP服務。,HTTP使用80 / TCP[root@linuxprobe ~]# firewall-cmd --add-service=http --permanentsuccess[root@linuxprobe ~]# firewall-cmd --reloadsuccess[4] 創(chuàng)建一個HTML測試頁,并使用Web瀏覽器從客戶端PC訪問它。如果顯示以下頁面,是正確的[root@linuxprobe ~]# vi /var/www/html/index.html<html><body><div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">Welcome access LinuxProbe.org,This is Test Page!</div></body></html>

三、支持Perl

啟用CGI執(zhí)行并使用Perl腳本

[1] 安裝Perl.[root@linuxprobe ~]# yum -y install perl perl-CGI[2] 默認情況下,在“/var/www/cgi-bin”目錄下允許CGI。 可以使用Perl Scripts放在目錄下。然而,它下面的所有文件都被處理為CGI。# 下面的設置是CGI的設置[root@linuxprobe ~]# grep -n "^ *ScriptAlias" /etc/httpd/conf/httpd.conf247: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"[3] 如果你想允許在其他目錄中的CGI,配置如下。 例如,在“/var/www/html/cgi-enabled”中允許。[root@linuxprobe ~]# vi /etc/httpd/conf.d/cgi-enabled.conf# create new# processes .cgi and .pl as CGI scripts<Directory "/var/www/html/cgi-enabled">  Options +ExecCGI  AddHandler cgi-script .cgi .pl</Directory>[root@linuxprobe ~]# systemctl restart httpd[4] 如果SELinux被啟用,并且允許CGI在不是像上面[3]的默認目錄下,更改規(guī)則如下。[root@linuxprobe ~]# chcon -R -t httpd_sys_script_exec_t /var/linuxprobe/html/cgi-enabled[root@linuxprobe ~]# semanage fcontext -a -t httpd_sys_script_exec_t /var/www/html/cgi-enabled[5] 創(chuàng)建一個CGI測試頁面,并使用Web瀏覽器從客戶端PC訪問它。如果顯示以下頁面,說明配置正確。[root@linuxprobe ~]# vi /var/www/html/cgi-enabled/index.cgi#!/usr/bin/perlprint "Content-type: text/html/n/n";print "<html>/n<body>/n";print "<div style=/"width: 100%; font-size: 40px; font-weight: bold; text-align: center;/">/n";print "CGI Test Page";print "/n</div>/n";print "</body>/n</html>/n";[root@linuxprobe ~]# chmod 705 /var/www/html/cgi-enabled/index.cgi 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 新巴尔虎右旗| 安图县| 且末县| 岑溪市| 色达县| 临海市| 呼和浩特市| 马公市| 图们市| 延边| 云南省| 五莲县| 微山县| 诸城市| 荔浦县| 东至县| 象山县| 应城市| 洞头县| 蓬安县| 奉新县| 锡林郭勒盟| 唐山市| 漯河市| 宁陕县| 洛宁县| 佛学| 沈阳市| 库伦旗| 锦州市| 济南市| 安达市| 泰兴市| 周宁县| 长泰县| 米易县| 景泰县| 阜宁县| 正阳县| 平江县| 鲁甸县|