一、http默认支持html语言
二、php语言
1、默认不支持,必须安装php插件
vim /var/www/html/index.php
添加:
<?php
phpinfo();
?>
systemctl restart httpd.service
cd /etc/httpd/conf.d
ls
出现:
php.conf
测试:172.25.254.138/index.php
2、默认不支持,需要对配置文件做修改
cd /var/www/html/
mkdir cgi
vim cgi/index.cgi
添加
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print `date`; `时1左边的
semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/cgi(/.*)?'
restorecon -RvvF /var/www/html/cgi
chmod +x /var/www/html/cgi/index.cgi 添加执行权限
<Directory "/var/www/html/cgi">
Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
</Directory>
systemctl restart httpd.service
测试:
172.25.254.138/cgi/index.cgi