所需工具:
1.MobaXterm_CHS
MobaXterm向Windows桌面提供所有重要的远程网络工具(SSH,X11,RDP,VNC,FTP,MOSH ……)和Unix命令(bash,ls,cat,sed,grep,awk,rsync等) ,在一个开箱即用的单个便携式exe文件中。为您的远程任务提供一体化网络应用程序有很多优点
2.xftp
Xftp是一个功能强大的SFTP、FTP 文件传输软件。使用了 Xftp 以后,MS Windows 用户能安全地在 UNIX/Linux 和 Windows PC 之间传输文件。Xftp 能同时适应初级用户和高级用户的需要。它采用了标准的 Windows 风格的向导,它简单的界面能与其他 Windows 应用程序紧密地协同工作,此外它还为高级用户提供了众多强劲的功能特性。
一、apache 安装配置
1 检查、删除、安装
rpm -qa|grep httpd //检查是否安装apache
rpm -e 包名 --nodeps //若有则删除 PS:我没有删除,直接用的服务器原来的。
yum install httpd //安装,根据提示,输入Y即可安装成功
2 启动、测试
systemctl start httpd //restart 重启 stop停止
3 查看 apache状态
service httpd status
4 配置httpd.conf文件,把AllowOverride改为了All。
vi /etc/httpd/conf/httpd.conf
5开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义:
- zone #作用域
- add-port=80/tcp #添加端口,格式为:端口/通讯协议
- permanent #永久生效,没有此参数重启后失效
6重启防火墙
firewall-cmd --reload #重启firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
7访问ip
二、CGI文件的创建
在第一步:yum install httpd
安装成功我们可以看到在/var/目录下会产生一个www的目录,该目录下还包含/cgi-bin/ /html/连个目录 ,cgi-bin目录下主要存放cgi文件。
/var/www/cgi-bin
在/cgi-bin文件下,先使用命令创建一个testCgi.c文件
必须包含:
printf("Content-Type: text/html;charset=utf-8\r\n\r\n");
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Content-Type: text/html;charset=utf-8\r\n\r\n");
printf("Hello World!");
return 0;
}
使用命令tcc编译:
tcc testCgi.c -o testCgi.cgi
三、结果显示
必须开放你的centos系统的80端口,httpd默认访问端口是80
接下来在网页中输入网址:http://IP/cgi-bin/testCgi.cgi(即http://ip:端口号/CGI文件名) 访问结果如图: