美文网首页
ubuntu apache 启动及配置

ubuntu apache 启动及配置

作者: 含辞未吐气若幽兰 | 来源:发表于2022-12-15 14:25 被阅读0次

Linux系统为Ubuntu

一、Start Apache 2 Server /启动apache服务

# /etc/init.d/apache2 start

or

$ sudo /etc/init.d/apache2 start

二、 Restart Apache 2 Server /重启apache服务

# /etc/init.d/apache2 restart

or

$ sudo /etc/init.d/apache2 restart

三、Stop Apache 2 Server /停止apache服务

# /etc/init.d/apache2 stop

or

$ sudo /etc/init.d/apache2 stop

配置

1、在./etc/ 找到hosts文件,在hosts里面添加域名指向虚拟机IP地址 如

192.168.**.**    video.xxx.com(命令行下ifconfig查看)

2、创建自己的根目录:

例如

sudo mkdir /wwwroot

子目录

sudo mkdir video

3、在video目录下创建自己的主页

sudo vi index.html

4.进入./etc/apache2/sites-available复制默认文件:

sudo cp -default.conf video.conf

5.修改vide.conf

sudo vi video.conf

将DocumentRoot 后面的目录改为/wwwroot/video

在ServerAdmin上一行加入

ServerName video.imooc.com

6.修改apache2.conf

增加

Options Indexes FollowSymLinks

AllowOverride None

Require all granted

7.建立软连接

进入/etc/apache2/sites-enabled 目录下打开命令行工具

sudo ln -s ../sites-available/video.conf video.conf

8.重启Apache2

/etc/init.d/apache2 restart

9.在浏览器输入video.xxx.com 会出现你创建的index.html内容

相关文章

网友评论

      本文标题:ubuntu apache 启动及配置

      本文链接:https://www.haomeiwen.com/subject/zkerqdtx.html