Linux:httpd配置,tomcat apche php

来源:互联网 发布:暗影格斗2破解办法mac 编辑:程序博客网 时间:2024/05/29 01:52

虚拟机配置,这个是你大学的作业吗?

 

,更改虚拟机网卡;这个就不用说了;添加一个静态的ip地址,一会用这个ip进行访问linux中的网页。关闭防火墙。

,进入 etc/httpd/conf/httpd.conf

修改配置文件,启用认证文件,添加认证文件在第三部;

 

 

AllowOverride None

AuthType Basic

AuthName"username"

AuthUserFile /var/www/html/username

require Valid-user

 

 

 

3,进入var/www/html文件

在终端添加一个用户:(提前在html文件里建立一个空白文件,名称为username

[root@localhost html]# htpasswd username xudeyu

 

4,更改一些权限,将username权限文件设置为不可见;访问网页时需要网页的可读写属性;

 

更改username文件的属性:

[root@localhost html]# chown apache username

[root@localhost html]# chmod u=rwx username

 

更改网页权限:给出所有的读写权限;

 

5,启动服务器

[root@localhost html]# Service httpd restart

6.用刚才的静态ip地址访问http//$ip/web/index.html

 

7.觉得刚才的ip访问是不是很费事,所以配置一个 www.xudeyu.com 进行访问;

 

7.1.修改/etc/http/conf/httpd.conf配置文件:一般在配置文档的最下面

VirtualHost example:

Almost any Apache directive may go into VirtualHost container.

The first VirtualHost section is used for requests without known

server name.

#

 

    DocumentRoot /var/www/html/web  

    ServerName www.xudeyu.com 

DirectoryIndex index0.html

 ErrorLog logs/dummy-host.example.com-error_log

 CustomLog logs/dummy-host.example.com-access_log common

#

7.2.打开C:\WINDOWS\system32\drivers\etc

修改host文件,在host文件的最后添加:也就是将ip和域名进行绑定:

192.168.11.179 www.xudeyu.com

8,访问www.xudyu.com 即可看到index0.html页面。参考以下截图:(保存在doc里,粘过来图就挂了,算了)


0 0
原创粉丝点击