发新话题
打印

用实验快速掌握web服务器Apache

用实验快速掌握web服务器Apache

  以下内容由伊甸园网友liuqing9906提供前言:Apache是大多数linux版本的标准web 服务器,掌握他的意义就非常大。
本文以实验的方式,让读者快速掌握Apache的基本配置。

[实验目的]
1.Apache的基本安装和配置。
2.Apache中应用CGI。
3.基本代理配置。
[实验要求]
1.两台互通的RH8.0机。
2.这两台机已配置过DNS。
[实验步骤]
1.准备工作。
由于web 服务器与DNS关系非常紧密。作好这步准备工作,请参考本人的另一篇文章
“用实验快速掌握DNS配置”。这篇文章发表在linuxsir的网络版块。
DNS 能够实现的主要功能就是能能解析:station1.exmaple1.com,
server1.example1.com 两个域名的IP,如果你想在/etc/hosts中实现,我想也不是不可
以。这里不提倡这么做。
本文中作法比较教条,这里指明机器1为:server1.example1.com,机器2为:
station1.example1.com .读者也可以自己变通。

2.在机器1上安装和配置简单的Apache。
1) 检查下列包是否安装,
httpd
httpd-manual
缺什么,装什么。
2) 开启httpd服务
# service httpd start
如果开启失败,查看/var/log/httpd/下的相关日志,切记要在/etc/hosts中添加类似
192.168.0.254 example1.com server1 的一行。
3) 检查/etc/httpd/conf/httpd.conf中,有下列一行活动
DocumentRoot /var/www/html
4) 用一个浏览器打开:
http://server1.example1.com
如果是正常情况,你会看到Apache的介绍页面。
5) 创建新的目录和html文件。
# mkdir -p /var/www/virtual/server1.example1.com/html
# vi /var/www/virtual/server1.example1.com/html/index.html
Server1.example1.com
6) 编辑/etc/httpd/conf/httpd.conf,末尾追加下列文本。
NameVirtualHost 192.168.0.254


ServerName server1.example1.com
ServerAdmin root@server1.example1.com
DocumentRoot /var/www/virtual/server1.example1.com/html
ErrorLog logs/server1.example1.com-error_log
CustomLog logs/server1.example1.com-access_log combined

Options Indexes Includes


7) 确保DNS能够解析你的VirtualHost
# host server1.example1.com
8) 重新启动httpd
# service httpd restart
如果启动失败,看/var/log/httpd/下的相应日志,会告诉你具体哪里错误。
9) 在浏览器里能够看到你自己写的网页了吗?
http://server1.example1.com
10) 在机器2上能看到http://server1.example1.com吗?

3.机器1,在Apache中应用CGI
1) 编辑/etc/httpd/conf/httpd.conf,在块中添加下列一行:
ScriptAlias /cgi-bin/ /var/www/virtual/server1.example1.com/cgi-bin/
2) 创建目录,创建文件。
# mkdir /var/www/virtual/server1.example1.com/cgi-bin
#vi /var/www/virtual/server1.example1.com/cgi-bin/test.sh

#!/bin/bash
echo Content-Type: text/html
echo

echo “”
echo My username is :
whoami
echo
echo My id i??獡s?? ??ゐ?!s :
id
echo
echo Here is /etc/passwd :
cat /etc/passwd
echo “”
3) 改变test.sh的执行权限:
# chmod 555 test.sh
4) 重启httpd服务:
# service httpd restart
若有错,看日志。
5) 浏览:http://server1.example1.com/cgi-bin/test.sh
6) 机器2能浏览http://server1.example1.com/cgi-bin/test.sh吗?

4.基本代理配置:
1) 机器1,检查squid 包装了没有,没有的话,则进行安装。
2) 机器1,启动squid 服务。
# service squid start
有问题? 看/var/log/messages.
3) 机器1,浏览器中设置代理端口为3128,举例:在mozilla: Edit | Preferences...|
Advanced | proxies 中,设定手动,端口为:3128,其他不动。
机器2,浏览器中类似设置为:手动,http代理:192.168.0.254 端口:3128。
4) 此时,机器1,能浏览server1.exmaple1.com.,若平时能上internet,此时也正常上
internet。
5) 机器2,不能浏览server1.example1.com 或internet。
查看/var/log/httpd/*的日志文件,原因是什么?
6) 编辑/etc/squid/squid.conf,在acl CONNECT method CONNECT行下,添加下列一行:
acl examample1 src 192.168.0.0/24
找到INSERT YOUR OWN RULE(S) HERE 增加下列一行:
http_access allow example1
7) 重启squid
# service squid restart
有错?看日志。
8) 此时,机器2能够浏览server1.example1.com 或 internet网页.
9) 编辑/etc/squid/squid.conf ,在acl examample1 src 192.168.0.0/24行下添加
acl otherdeny dstdomain .sina.com.cn
在http_access allow example1下添加:
http_access deny otherdeny
10) 重启squid.
# service squid restart
有错? 看日志。
11) 机器2,仍能浏览 http://www.sina.com.cn,为什么
12) 编辑/etc/squid/squid.conf ,把http_access deny otherdeny放到
http_access allow example1前面,重启squid,机器2还能看到
http://www.sina.com.cn

[实验总结]
Apache配置是否成功,与DNS有很大关系,所以,要求读者先花时间作好DNS工作。本文
以最通俗的方式,教你简单的配置Apache,如果想深入掌握它,还得研究Apache2.0的文档
。最近看到http://kajaa.bbs.us/ApacheManual/zh-cn/是kajaa老兄翻译成了Apache
的中文文档,相信对大家一定有好处。

TOP

based on advice

FFXI Gil Goodling also sought out the advice of the White House and other Republicans in filling vacant immigration judge positions. Goodling -- who declined to be interviewed by the authors of the report -- previously testified that she believed it was legal to consider political factors in selecting judges based on advice she had received from Sampson.

TOP

Durham overcome floodlight farce to claim last-eight spot internet health

Durham overcome floodlight farce to claim last-eight spot internet health

Mason Hunt, the protagonist of Martin Clark''s powerful novel, "The Legal Limit," is one of those smart country boys who make it, despite the odds. Reared by a mother floodlight struggling to make ends meet with factory work, he lands a job as the commonwealth''s attorney in his Virginia hometown, Stuart.
Meanwhile, his deadbeat brother, Gates, www.floodlightdesign.com is serving a 44-year sentence for drug dealing, a fact that the arclight locals don''t hold against Mason.
But Mason and his brother share a secret. While Mason was in law school, he watched his brother kill a man who was vying for Gates'' girlfriend. Together, they covered up the crime.
Nearly two decades later, the wayward brother is tired of sitting in jail. After all, a brother that well-connected in the legal system could surely pull a few strings and get Gates released early. Otherwise, he might have to mention his brother''s role in the murder and subsequent cover-up.
Maybe even reverse their roles and claim Mason was the shooter.
Mason, a widower raising his only child alone, floodlight  is understandably unwilling to be coerced into a blackmailing scheme or to go to prison as a wrongfully convicted murderer.
"I will kill Gates Hunt before I let my daughter lose another parent," he tells himself.
But once the cops begin investigating his brother''s kiis fm claim, Mason might be facing more than he can handle.
At this point, halfway through the book, "The Legal Limit" becomes an edge-of-your-seat legal thriller. Before that, though, it meanders along at a country-lane pace, documenting Mason''s rise as a lawyer and his subsequent return to rural life.
It''s an enjoyable journey. Clark, a circuit judge who lives in Stuart, knows his novel''s turf intimately, and his ear for dialogue and attention to the details of his rural setting are superb.
Once the investigation begins, though, the pace quickens, and the nature imagery turns predatory.
When two investigators first interview Mason about his brother''s claim, Clark writes that their patient questioning "reminded Mason of the summer toads at the farm, always biding their time beneath a floodlight or brightened transom, vigilant brown lumps watching . . . watching . . . watching . . . watching, waiting for a gnat or moth to dip too deep and become food for a sticky, darting tongue."
The issues at play in "The Legal Limit" are weighty -- among them, the bond (and limit) of fraternal loyalty and the subtle distinction between justice and the law. Clark manages to make www.floodlight.co.uk them emotionally compelling, rather than programmatic -- no mean feat.
But that shift to nail-biting thriller is a rush, and readers watch the dark knight online may find themselves taking sides on the philosophical issues only after they have finished the book.
Unlike a lot of summer books, "The Legal Limit" floodlight isn''t a guilty pleasure. Take it to the beach and turn the pages breathlessly. Then mull over its deeper themes on that long ride home.

TOP

进口轴承

TOP

成语高手上班挤公车

1.出师不利:搬家后,第一次坐公交车上班,挤了一个小时愣没上去车。
幽默笑话

2.笨鸟先飞:第二天早晨4点半起床,顾不得洗脸就出发了。 幽默笑话

3.操之过急:到了车站,发现第一班车是5点半的,又苦等了1小时。 笑话

4.爱莫能助:和老婆一起挤车,我被人流推上去,老婆的手支撑不住松开了,瞬间我们俩之间插进来有数十人,眼看着老婆在车下顿足捶胸。

幽默笑话

5.百思不解:车上拥挤不堪,人头攒动。到了某站,前、中、后门一共下去155人,可车上依然是摩肩接踵,不知道下去的乘客刚才站在哪里了。

成人笑话

6.名不副实:无论车上多挤,乘客们到了办公室后,别人问怎么来的,都说“坐”公交来的,可有几个是真正坐着的呢? 幽默笑话

7.得陇望蜀:一位瘦弱的仁兄好容易挤到门里。关门后,他哀求道:“大家能不能使把劲儿,让我的那一只脚也能着地。”

提供液面计截止阀、气动截止阀、手动截止阀、美标止回阀、消声止回阀、静音止回阀、气体减压阀、空气减压阀、倒置桶型疏水阀、浮球热静力疏水阀等产品。

8.业精于勤:走在路上,看带红道的大客车就忍不住猛跑追几步。

成人笑话

9.东施效颦:发现一起等车的一个MM被一位男士从窗户拉了进去,慌忙叫自己的同事也拉自己,结果非但自己没上去,还将同事从车里拽了下来。 笑话

10.惜香怜玉:一个好心的大姐把我推上了车,可车门关闭了,她还没能上来。我于是狂喊售票员开门,让大姐上来。售票员微微一笑:“不用管她。”这时,我发现那位大姐潇洒地坐在司机的位置上。 幽默笑话

11.左右逢源:被两个壮汉夹在中间,他们的肚子像西瓜一样圆。

极品笑话


12.自讨苦吃:有一位朋友,每天准时坐同一班次的公交车,哪怕前车、后车很空他也不去,宁愿挤这班。
low wow gold price

TOP

发新话题