【教程】移植web server到Ubuntu就是这么简单!
来源:互联网 发布:优酷弹幕怎么没了 知乎 编辑:程序博客网 时间:2024/06/05 01:19
Ubuntu:Ubuntu9.10
目的:移植web server到Ubuntu
window下载thttpd,地址:http://www.acme.com/software/thttpd/
1.上传thttpd到ubuntu,解压,配置,安装
$ tar zxf thttpd-2.27.tar.gz
$ cd thttpd-2.27/
$ ./configure
$ make
$ sudo make install
虽然安装有错,但不影响
将安装thttpd等程序到/usr/local/sbin,同时默认web目录是/usr/local/www
3.创建配置文件thttpd.conf,建议放到/etc目录
$cd /etc
$touch thttpd.conf
$vi thttpd.conf, 内容为:
dir=/usr/local/www #指明WebServer存放网页的根目录路径
user=root #以root用户登录,权利更大
logfile=/var/log/thttpd.log #日志文件
pidfile=/var/run/thttpd.pid #进程临时文件
port=8080 #端口号
cgipat=/cgi-bin/* #声明CGI程序的目录,注意是以dir为根目录的路径
4. 拷贝当前目录下的 index.html文件到web目录
$ sudo cp index.html /usr/local/www
5. 运行web服务器
$sudo thttpd -C /etc/thttpd.conf
6.windows浏览器上输入:http://192.168.1.199:8080(Ubuntu IP为192.168.1.199)
如果看到以下界面,就代表web服务器已经搭建好了
7.当然也可以编写test.c测试CGI程序
vi test.c,内容为:
//file: test.c
#include <stdio.h>
#include <string.h>
int main()
{
printf("Content type: text/html\n\n");
printf("<html>\n");
printf("<head><title>CGI</title></head>\n");
printf("<body bgcolor=\"#666666\">");
printf("<p>");
printf("<center><H1>This is just a cgi testpage</H1></center>");
printf("</body>\n");
printf("</html>\n");
fflush(stdout);
return 0;
}
8. 编译test.c生成cgi程序
$ gcc test.c -o test.cgi
9.将 test.cgi拷贝到cgi目录下
$ sudo cp test.cgi /usr/local/www/cgi-bin/
10. 在浏览器上输入192.168.1.199:8080/cgi-bin/test.cgi访问这个cgi程序
看到以下界面就代表cgi程序执行正常
- 【教程】移植web server到Ubuntu就是这么简单!
- 【教程】制作开机LOGO就是这么简单!
- nodejs搭建web服务器就是这么简单!
- 生活就是这么简单
- 记忆就是这么简单
- 快乐,就是这么简单
- 快乐就是这么简单
- 就是这么简单
- 多线程,就是这么简单!
- 自然语言处理环境搭建,就是这么简单–(手把手教程)
- Nginx Linux 安装 教程 就是这么简单 基于1.12X
- Nginx Linux 安装 教程 就是这么简单 基于1.12X
- 在ubuntu 下升级内核就是这么简单。。。。
- 就是这么简单!使用Rest-assured 测试Restful Web Services
- 就是这么简单!使用Rest-assured 测试Restful Web Services
- 将MathType公式粘贴到文档中就是这么简单
- 企业搜索,就是这么简单!
- 线程管理 就是这么简单
- Oracle之SQL语句优化(第一篇)
- 物品管理类ItemController
- pychram&GitHub使用经验
- 几维安全为新同学详细解读反汇编是什么意思?
- iPhone获取状态栏和导航栏尺寸(宽度和高度)
- 【教程】移植web server到Ubuntu就是这么简单!
- git替换
- dubbo是怎么调用方法的
- 'latin-1' codec can't encode characters in position 2-3: ordinal not in range(256)
- 记录在cdh使用中遇到的坑,cdh Reports Manager
- 高速光耦(PS8101,TLP112A,TLP109)基本工作原理应用实例
- 使用UIImagePickerController导致[Generic] Creating an image format with an unknown type is an error
- node.js ejs 渲染moment
- 关于git的config