ubuntu安装apache2

安装apache2

root@yaoyafei:~# apt-get update
root@yaoyafei:~# apt-get install -y apache2

安装完成以后查看服务状态,没有运行

root@yaoyafei:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: inactive (dead)

手动启一下,幷加到开机自启中

root@yaoyafei:~# systemctl start apache2
root@yaoyafei:~# systemctl enable apache2
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2

查看状态,显示的enable表示开机自启

root@yaoyafei:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled;(开机自启) vendor preset: enable)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Sat 2021-09-11 11:59:25 UTC; 37s ago
 Main PID: 2602 (apache2)
    Tasks: 55 (limit: 2287)
   CGroup: /system.slice/apache2.service
           ├─2602 /usr/sbin/apache2 -k start
           ├─2604 /usr/sbin/apache2 -k start
           └─2607 /usr/sbin/apache2 -k start

端口修改在/etc/apache2/ports.conf文件中
默认的文件目录在/etc/apache2/apache2.conf 文件中
修改完成后执行systemctl reload apache2

root@yaoyafei:/etc/apache2# systemctl restart apache2
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu安装Apache非常直接。首先,你需要更新软件包索引并安装Apache软件包。可以使用以下命令来完成这些操作: sudo apt update sudo apt install apache2 引用提供了具体的命令和步骤来安装Apache。通过运行这些命令,你可以在Ubuntu上成功地安装Apache。 请注意,引用提供了有关在Ubuntu安装和配置Apache的更详细的信息。你可以查看该引用获取更多关于Apache的相关信息。 安装完成后,你可以通过打开HTTP和HTTPS端口来开始使用Apache。可以按照引用中的指示进行操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [如何在 Ubuntu 20.04 上安装 Apache](https://blog.csdn.net/a_small_cherry/article/details/122973092)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [Ubuntuapache安装与配置](https://blog.csdn.net/gatieme/article/details/53025505)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值