linux入门笔记23.doc_第1页
linux入门笔记23.doc_第2页
linux入门笔记23.doc_第3页
linux入门笔记23.doc_第4页
linux入门笔记23.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

APACHE ( A patchserver )能头提供web服务的一种软件。windows IISnginxlighttpdweb服务的端口:80软件安装:rpm -ivh httpd.rpmyum install - linux + nginx 版本:1.02.0优点:进程控制,就是说,可以根据需要来调整进程的数量支持动态模块支持虚拟主机几个和网络相关的名词?网络空间:/469959740/fqdn:Full Quality Domain Name全质量域名URL:Uniform /Universal ResourceLocation统一资源定位符网页地址//sports/服务安装之后,进行相应的配置:配置文件的目录:/etc/httpd/conf/etc/httpd/conf.d这两个目录,是指你使用rpm包安装之后的配置目录。主配置文件:httpd.confvim /etc/httpd/conf/httpd.conf57 ServerRoot /etc/httpd服务器配置文件存放的根路径134 Listen 80指定web服务器的监听端口/:80/:90/210 Include conf.d/*.conf231 User apache232 Group apache指定Apache服务运行是所使用的用户身份281 DocumentRoot/var/www/html网站的根目录/391 DirectoryIndex index.htmlindex.html.var网站的默认索引页面/index.html472 ErrorLoglogs/error_log (相对路径/etc/httpd/logs)网站的错误日志存放的位置514 CustomLoglogs/access_log combined网站的正常访问日志存放的位置539 Alias /icons/ /var/www/icons/网络资源别名/icons/ - /var/www/icons/ 假设,没有alias /icons/这个别名设置存在,那么,/icons/ - /var/www/html/icons/54/docs/ - /var/www/html/docs/alias/docs/ /tmp/docs/564 ScriptAlias/cgi-bin/ /var/www/cgi-bin/脚本别名启动服务:/etc/init.d/httpd startstoprestartservice httpd start stop restartchkconfig httpd on查看你的服务是否正常启动:# netstat -antlup | grep :80tcp 0 0:80 :* LISTEN 18850/httpd 测试你的网站:#firefox http:/localhost/ &如果你看到一个apahce的页面,那么说明你的网站已经正常了。Alias /error/var/www/error/var/www/error/noindex.html创建一个简单的网络首页:#cd /var/www/html#echo Teacher Server index.html#firefox http:/localhost &容器访问控制:Options Indexes FollowSymLinksIndexes:表示如果找不到索引页面,那么,这个目录下面的文件,以列表的形式显示给用户;FollowSymLinks:可以跟随符号连接;AllowOverride NoneOrder allow,denyAllow from allOrder:表示允许拒绝的顺序,前面的表示优先匹配,后面的表示默认白名单的写法:order allow,denyallow from 15/24黑名单的写法:order deny,allowdeny from 88页面访问控制,使用用户名密码的方式实现网页访问控制: options Indexes FollowSymLinks AllowOverride noneOrder allow,denyallow from allAuthname Do not allow DDW toaccessAuthtype BasicAuthUserfile /tmp/htpasswdRequire valid-user# htpasswd -c/tmp/htpasswd bj1New password: Re-type newpassword: Adding passwordfor user bj1rootlocalhostconf# firefox http:/localhost/docs &rootlocalhostconf# htpasswd -m /tmp/htpasswd bj1New password: Re-type newpassword: Updatingpassword for user bj1通过一个文件来实现这种网页访问控制:options Indexes FollowSymLinksAllowOverride allorder allow,denyallow from all#cd/var/www/html/docs#vim .htaccess Authname Do not allow DDW toaccessAuthtype BasicAuthUserfile /tmp/htpasswdRequire valid-user# htpasswd -c/tmp/htpasswd bj1New password: Re-type newpassword: Adding passwordfor user bj1rootlocalhostconf# firefox http:/localhost/docs &rootlocalhostconf# htpasswd -m /tmp/htpasswd bj1New password: Re-type newpassword: Updatingpassword for user bj1个人主页:#vim /etc/httpd/conf/httpd.conf362 #UserDir disable将这一行注释掉369 UserDir public_html将这一行的注释取消表示你需要在用户的家目录下面创建一个public_html这样的目录,然后,将你的网页放到这个路径下面,其他人就可以根据用户名访问你的主页了#/etc/init.d/httpd restart注意要给这个目录设置权限,使apache用户能够进入用户的家目录#chmod o+x /home/u1测试:#firefoxhttp:/localhost/u1/public_html/bind.html&Q:为了取消,使用哪种方法?firefox http:/localhost/u1/ &第一种方法:aliasvim /etc/httpd/conf/httpd.confalias /u1/home/u1/public_html/第二种方法:使用符号连接这个方法你们自己去实现虚拟主机:虚拟主机的类型:1,基于端口的2,基于ip地址的3,基于域名的基于端口的虚拟主机:vim /etc/httpd/conf/httpd.confListen 80Listen 90vim /etc/httpd/conf.d/vhost.conf DocumentRoot/var/www/html/w80 ServerN ErrorLoglogs/w80_error.log CustomLoglogs/w80_access.log common DocumentRoot/var/www/html/w90 ServerN ErrorLoglogs/w90_error.log CustomLoglogs/w90_access.log common测试:firefox http;/15:80firefoxhttp;/15:90基于ip地址的虚拟主机:一个网卡可以绑定多个ip地址:#ifconfig eth0:0 54vim /etc/httpd/conf.d/vhostip.confDocumentRoot /var/www/html/w2 ServerNErrorLog logs/w2_error.logCustomLog logs/w2_access.log commonDocumentRoot /var/www/html/w3ServerName ErrorLog logs/w3_error.logCustomLog logs/w3_access.log common测试:firefox 54firefox 54基于域名的虚拟主机:vim /etc/httpd/conf/httpd.conf980 NameVirtualHost *:80vim/etc/httpd/conf.d/vhostname.confDocumentRoot /va

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论