码迷,mamicode.com
首页 > Web开发 > 详细

centos httpd + ubuntu conf位置

时间:2015-07-22 18:02:20      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

linux版本 RHEL7.0

IP地址172.7.16.111

 

apache服务的包名为httpd,检查包

技术分享

 

使用yum源安装包,
配置yum方法可以参考我的博客 《linux yum源配置方法》http://blog.itpub.net/27771627/viewspace-1223153/

[root@rh ~]# yum -y install httpd

Loaded plugins: langpacks, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

testyum | 4.1 kB 00:00:00

Resolving Dependencies

--> Running transaction check

---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed

--> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64

--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-17.el7.x86_64

--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64

--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64

--> Running transaction check

---> Package apr.x86_64 0:1.4.8-3.el7 will be installed

---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed

---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed

---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================

Package Arch Version Repository Size

==================================================================================================================

Installing:

httpd x86_64 2.4.6-17.el7 testyum 1.2 M

Installing for dependencies:

apr x86_64 1.4.8-3.el7 testyum 103 k

apr-util x86_64 1.5.2-6.el7 testyum 92 k

httpd-tools x86_64 2.4.6-17.el7 testyum 77 k

mailcap noarch 2.1.41-2.el7 testyum 31 k

Transaction Summary

==================================================================================================================

Install 1 Package (+4 Dependent packages)

Total download size: 1.5 M

Installed size: 4.3 M

Downloading packages:

------------------------------------------------------------------------------------------------------------------

Total 4.3 MB/s | 1.5 MB 00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : apr-1.4.8-3.el7.x86_64 1/5

Installing : apr-util-1.5.2-6.el7.x86_64 2/5

Installing : httpd-tools-2.4.6-17.el7.x86_64 3/5

Installing : mailcap-2.1.41-2.el7.noarch 4/5

Installing : httpd-2.4.6-17.el7.x86_64 5/5

Verifying : mailcap-2.1.41-2.el7.noarch 1/5

Verifying : httpd-tools-2.4.6-17.el7.x86_64 2/5

Verifying : apr-1.4.8-3.el7.x86_64 3/5

Verifying : apr-util-1.5.2-6.el7.x86_64 4/5

Verifying : httpd-2.4.6-17.el7.x86_64 5/5

Installed:

httpd.x86_64 0:2.4.6-17.el7

Dependency Installed:

apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-17.el7

mailcap.noarch 0:2.1.41-2.el7

Complete!

 

 

查看配置文件

技术分享

 

 

需要配置的文件为/etc/httpd/conf/httpd.conf

查看配置文件,过滤以下字段,默认主页路径为以下

技术分享

 

 

默认主页名为index.html

技术分享

 

 

进入主页路径,创建一个测试网页

技术分享

 

 

重启httpd服务

技术分享

 

 

设置开机自启动

技术分享

 

 

设置防火墙,使http服务可以通过防火墙

技术分享

 

 

重启防火墙

技术分享

 

 

本机测试http服务配置成功

技术分享

 

 

windows客户端浏览器测试成功

技术分享

 

 

至此apache服务已经配置成功,接下来继续配置目录共享

创建共享目录,将共享文件放里面

技术分享

 

 

编辑配置文件/etc/httpd/conf.d/autoindex.conf

加入如下配置内容

Alias /share "/LiuZhenSHARE"

<directory "="" liuzhenshare"="">

Options Indexes MultiViews FollowSymlinks

AllowOverride None

Require all granted

 

 

技术分享

 

 

修改完配置文件,重启服务

技术分享

 

 

安装elink包在server本机测试

[root@rh LiuZhenSHARE]# yum -y install elinks

Loaded plugins: langpacks, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Resolving Dependencies

--> Running transaction check

---> Package elinks.x86_64 0:0.12-0.36.pre6.el7 will be installed

--> Processing Dependency: libnss_compat_ossl.so.0()(64bit) for package: elinks-0.12-0.36.pre6.el7.x86_64

--> Running transaction check

---> Package nss_compat_ossl.x86_64 0:0.9.6-8.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================

Package Arch Version Repository Size

==================================================================================================================

Installing:

elinks x86_64 0.12-0.36.pre6.el7 testyum 882 k

Installing for dependencies:

nss_compat_ossl x86_64 0.9.6-8.el7 testyum 37 k

Transaction Summary

==================================================================================================================

Install 1 Package (+1 Dependent package)

Total download size: 919 k

Installed size: 2.7 M

Downloading packages:

------------------------------------------------------------------------------------------------------------------

Total 2.5 MB/s | 919 kB 00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : nss_compat_ossl-0.9.6-8.el7.x86_64 1/2

Installing : elinks-0.12-0.36.pre6.el7.x86_64 2/2

Verifying : elinks-0.12-0.36.pre6.el7.x86_64 1/2

Verifying : nss_compat_ossl-0.9.6-8.el7.x86_64 2/2

Installed:

elinks.x86_64 0:0.12-0.36.pre6.el7

Dependency Installed:

nss_compat_ossl.x86_64 0:0.9.6-8.el7

Complete!

 

 

执行以下命令server端本机测试

技术分享

 

 

执行后出现share的文件

技术分享

 

 

使用windows浏览器测试,

技术分享

 

测试成功,配置完成

 

 

 

关于ubuntu配置文件,严格地说Ubuntu的Apache(或者应该说Linux下的Apache?我不清楚其他发行版的 apache软件包)的配置文件是 /etc/apache2/apache2.conf,Apache在启动时会自动读取这个文件的配置信息。而其他的一些配置文件,如 httpd.conf等,则是通过Include指令包含进来。在apache2.conf中可以找到这些Include行: 

引用 

# Include module configuration: 
Include /etc/apache2/mods-enabled/*.load 
Include /etc/apache2/mods-enabled/*.conf 

# Include all the user configurations: 
Include /etc/apache2/httpd.conf 

# Include ports listing 
Include /etc/apache2/ports.conf 
…… 

# Include generic snippets of statements 
Include /etc/apache2/conf.d/ 

# Include the virtual host configurations: 
Include /etc/apache2/sites-enabled/ 
结合注释,可以很清楚地看出每个配置文件的大体作用。当然,你完全可以把所有的设置放在apache2.conf或者httpd.conf或者任何一个配置文件中。Apache2的这种划分只是一种比较好的习惯。 

安装完Apache后的最重要的一件事就是要知道Web文档根目录在什么地方,对于Ubuntu而言,默认的是/var/www。怎么知道 的呢?apache2.conf里并没有DocumentRoot项,httpd.conf又是空的,因此肯定在其他的文件中。经过搜索,发现在 /etc /apache2/sites-enabled/000-default中,里面有这样的内容: 

引用 

NameVirtualHost * 
<VirtualHost *> 
ServerAdmin webmaster @localhost 

DocumentRoot /var/www/

 

centos httpd + ubuntu conf位置

标签:

原文地址:http://www.cnblogs.com/banwhui/p/4667729.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!