ubuntu 安装 + 配置 Apache(急速版)

1、sudo apt-get install apache2

2、sudo gedit /etc/apache2/apache2.conf,gedit、vi或者vim,根据习惯和系统自己选择编辑器

#<Directory /var/www/>(原本的)
<Directory /home/wuhao/www/>(修改后自己指定的目录)

3、sudo gedit /etc/apache2/sites-available/000-default.conf

    #DocumentRoot /var/www/html(原本的)
    DocumentRoot /home/wuhao/www(修改后自己指定的目录)

4、sudo /etc/init.d/apache2 restart

成功: * Restarting web server apache2                                         [ OK ] 

如果重新启动出现下面报错,执行第三步骤,再文件最后添加:ServerName 127.0.0.1
 * Restarting web server apache2                                                

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

5、测试1:

wget http://127.0.0.1
--2020-09-11 09:16:06--  http://127.0.0.1/
正在连接 127.0.0.1:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 4955 (4.8K) [text/html]
正在保存至: “index.html”

100%[======================================>] 4,955       --.-K/s   用时 0s    

2020-09-11 09:16:06 (254 MB/s) - 已保存 “index.html” [4955/4955])

6、测试2:我的ip地址:192.168.18.121

wget http://192.168.18.121
--2020-09-11 09:17:09--  http://192.168.18.121/
正在连接 192.168.18.121:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 4960 (4.8K) [text/html]
正在保存至: “index.html.1”

100%[======================================>] 4,960       --.-K/s   用时 0s    

2020-09-11 09:17:09 (986 MB/s) - 已保存 “index.html.1” [4960/4960])

7、测试3:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值