apache启服务命令_Linux系统重启apache服务命令详解

Linux系统中apache是重要的一个服务,掌握基本操作尤其重要。下面由学习啦小编为大家整理了Linux系统重启apache服务命令详解,希望对大家有帮助!

Linux系统重启apache服务命令详解

基本的操作方法:

本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

apahce启动命令:

推荐/usr/local/apache2/bin/apachectl start apaceh启动

apache停止命令

/usr/local/apache2/bin/apachectl stop 停止

apache重新启动命令:

/usr/local/apache2/bin/apachectl restart 重启

要在重启 Apache 服务器时不中断当前的连接,则应运行:

/usr/local/sbin/apachectl graceful

如果apache安装成为linux的服务的话,可以用以下命令操作:

service httpd start 启动

service httpd restart 重新启动

service httpd stop 停止服务

Linux系统为Ubuntu时重启apache

一、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

参考资料:关于Ubuntu配置文件apache2 httpd.conf位置

关于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 *

ServerAdmin webmaster @localhost

DocumentRoot /var/www/

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值