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

首頁 > 網站 > Apache > 正文

CentOS 7.2配置Apache服務httpd(上)

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

一、Apache簡介

Apache HTTP Server(簡稱Apache)是Apache軟件基金會的一個開放源代碼的網頁服務器軟件,可以在大多數電腦操作系統中運行,由于其跨平臺和安全性(盡管不斷有新的漏洞被發現,但由于其開放源代碼的特點,漏洞總能被很快修補。因此總合來說,其安全性還是相當高的。)。被廣泛使用,是最流行的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,將服務器名稱替換為您自己的環境[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] 創建一個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執行并使用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]的默認目錄下,更改規則如下。[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] 創建一個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             
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 榆树市| 聊城市| 商河县| 中山市| 云林县| 绥江县| 清水县| 大冶市| 通化市| 辉县市| 封开县| 南雄市| 长寿区| 和政县| 祁门县| 广昌县| 盖州市| 光泽县| 勃利县| 中阳县| 噶尔县| 于都县| 庄河市| 遵义县| 静安区| 株洲市| 离岛区| 淳安县| 博白县| 定西市| 天镇县| 镶黄旗| 张北县| 通辽市| 都兰县| 景德镇市| 石泉县| 唐河县| 宽甸| 新竹县| 黄梅县|