沃梦达 / 编程技术 / 服务器 / 正文

ubuntu14.04.1配置apache与yum

1、安装apahceapt-get install apache22、默认网站根目录Apache的安装路径为/var默认的网站根目录的路径为/var/www/html3、配置apache自启动Apache2.conf 位置: /etc/apache2/apache2.confvim /etc/apache2/a...

1、安装apahce

apt-get install apache2

2、默认网站根目录

Apache的安装路径为/var

默认的网站根目录的路径为/var/www/html

3、配置apache自启动

Apache2.conf 位置: /etc/apache2/apache2.conf

vim /etc/apache2/apache2.conf

在打开的apache2.conf文件尾部添加如下信息:

#ServerName

ServerName [ip地址]

4、重启apache

目录:/etc/init.d/apache2 restart

./apache2 restart
5、重启电脑,检测服务能否自启动;本机访问

浏览器输 http:[之前配置的ip地址] 回车之后看到

配置基于http的包更新源
1、在终端窗口中输入"sudo vi /etc/apache2/apache2.conf" ,回车,找到"<Directory /var/www/>"的位置,更改"/var/www/"为新的根目录就可以了
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

2,在终端窗口中输入"sudo vi /etc/apache2/sites-available/000-default.conf"-->回车-->找到"DocumentRoot /var/www/html"的位置-->更改"/var/www/html"为新的根目录就可以了,这里我把它更改为"/var/www/" 或者也可以自己新建一个repo_server.conf,里面配置如下:
<VirtualHost :28000>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/repo
<Directory '/var/www/repo'>
Options Includes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
ErrorLog /var/log/apache2/repo_server-error.log
CustomLog /var/log/apache2/repo_server.log common
</VirtualHost>
注:repo下要拷贝iso上的dists目录过来
3、配置端口
在/etc/apache2/ports.conf
输入Listen :28000
保存退出

第六步:重启Apache:

在终端窗口中输入"sudo /etc/init.d/apache2 restart" 回车,输入root用户密码,回车,重启成功

客户端配置
1、找到/etc/apt/sources.list
2、输入deb [arch=amd64] http://11.11.177.72:28000 (dists)ngiam main
3、保存退出即可

本文标题为:ubuntu14.04.1配置apache与yum

基础教程推荐