Linux操作系统实验四.doc

时间:2021-03-13 09:53:32
【文件属性】:
文件名称:Linux操作系统实验四.doc
文件大小:1.11MB
文件格式:DOC
更新时间:2021-03-13 09:53:32
linux linux操作系统 大学实验 计算机系 一、 实验目的 1、通过实验了解和熟悉Linux网络服务; 2、掌握Linux下建立Web服务器; 3、掌握Linux下建立FTP服务器。 二、 开发工具和运行环境 1、虚拟机VMware 2、Linux操作系统 三、 实验内容 1、了解和熟悉Linux网络服务 了解NFS网络文件系统,NFS网络文件系统架设及挂载方法,Web服务器的架设方法,FTP服务器的架设方法及访问方法,Samba服务器的架设方法。 2、Linux下建立Web服务器 (1)Apache 服务器的安装及启动 ●检测与安装 Apache rpm -qa | grep httpd ●如果没有检测到软件包,需要进行安装,在安装目录中,执行如下命令: rpm -ivh httpd-tools*. Rpm rpm -ivh mailcap-2.1.31-2.el6.noarch.rpm rpm - ivh httpd-2*. rpm rpm -ivh httpd-manual-2.*.rpm ●重新启动/停止/启动Apache服务: systemctl restart/stop/start httpd.service 或service httpd restart/stop/start ●查看 Apache服务器的运行状态: systemctl status httpd. service 或service httpd status ●测试 Apache服务器运行状态: 在图形界面打开火狐浏览器输入http://127. 0.0.1呈现测试页(CentOS 用户可以在终端使用lynx 浏览器打开,如没有安装,则使用rpm在光盘中安装lynx 浏览器) 在/var/www/html目录下创建test. html页面,使用vi编辑保存内容,重启apache服务 在火狐浏览器输入http://127. 0. 0.1/test. html查看test. html内容 (2)Apache 服务器的配置 Apache主要配置文件为httpd.conf,存储位置在/etc/httpd/conf目录下 (3)个人Web站点配置 RedHat方式: a:修改配置文件,使用vi编辑器修改主配置文件 /etc/httpd/conf/httpd. conf,修改如下配置,去掉原文中的注释符号 UserDir disable root//基于安全 考虑,禁止root用户使用自己的站点.UserDir public. _html//设 置对每个用户的Web站点目录 Allow0verride FileInfo AuthConfig Limit Opt ions MultiViews Indexes SymLinkIfOwnerMatch Inc ludeNoExec Order allow, deny Allow from all Order deny, allow Deny from all 保存文件退出,重启httpd服务 b:用户创建个人Web站点 从root用户身份切换成user1用户(如果没有普通用户,需要先创建普通用户): 在user1主目录下面创建个人站点目录$mkdir public_ html 到/home目录下修改user1目录权限 $chmod 711 user1 进入到public. _html 目录下使用vi创建index. html文件,保存退出重启httpd服务 在浏览器中输入网址http://127.0.0.1/ user1/index. html,查看效果======= CentOS方式: a:修改配置文件,使用vi编辑器修改/etc/httpd/ conf.d/userdir.conf修改成如下配置信息 UserDir disable root//基于安全 考虑,禁止root用户使用自己的站点 UserDir public_ html//设置对每个用户的Web站点目录 Allowverride None #修改为 None options None#修改为None Require method GET POST OPTIONS b:用户创建个人Web站点

网友评论