`

Ubuntu Linux: Start / Restart / Stop Apache Web Server

阅读更多

Ubuntu Linux: Start / Restart / Stop Apache Web Server

by NIX CRAFT on FEBRUARY 6, 2008 · 20 COMMENTS· LAST UPDATED NOVEMBER 2, 2013

in APACHECOMMANDSDEBIAN / UBUNTU

 

How do I start, restart, or stop Apache 2.x web server on Ubuntu Linux operating systems using command line options?

You can use any one of the following method to restart / start / stop your Apache (httpd) sever on Ubuntu:

 

 

Tutorial details  
Difficulty Easy (rss)
Root privileges Yes
Requirements Shell
Estimated completion time 1m
  1. /etc/init.d/apache2 - A sys v init style script to start / stop / restart the Apache2 service under Debian or Ubuntu Linux.
  2. service command - This command work in most Linux distributions including Debian and Ubuntu.
  3. upstart command - Only works on latest version of Ubuntu.
  4. apache2ctl command - This method should work on all Linux and Unix like operating systems.

Method #1: /etc/init.d/apache2 command examples

You need to login as root user or use the sudo command to control Apache web-server.

Task: Start Apache 2 Server

# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start

Task: Restart Apache 2 Server

# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart

Task: Stop Apache 2 Server

# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop

Method #2: service command examples

To restart Apache 2, enter:
$ sudo service apache2 restart
To stop Apache 2, enter:
$ sudo service apache2 stop
To start Apache 2, enter:
$ sudo service apache2 start
To gracefully reload Apache 2, enter:
$ sudo service apache2 reload

Method #3: upstart command examples

To start Apache 2 on Ubuntu, run:
$ sudo start apache2
To stop Apache 2 on Ubuntu, run:
$ sudo stop apache2
To restart Apache 2 on Ubuntu, run:
$ sudo restart apache2
To gracefully reload Apache 2 on Ubuntu, run:
$ sudo restart apache2

Method #4: apache2ctl command examples

apache2ctl is Apache HTTP server control interface command, which can be used to stop or start web server under any Linux distribution or UNIX.
To start Apache 2 on Ubuntu, type:
$ sudo apache2ctl start
To stop Apache 2 on Ubuntu, type:
$ sudo apache2ctl stop
To restart Apache 2 on Ubuntu, type:
$ sudo apache2ctl restart
To gracefully reload Apache 2 on Ubuntu, type:
$ sudo apache2ctl graceful

1
0
分享到:
评论

相关推荐

    Linux系统下操作Apache最基本的启动停止和重启命令

    推荐/usr/local/apache2/bin/apachectl start apaceh启动 apache停止命令 /usr/local/apache2/bin/apachectl stop 停止 apache重新启动命令: /usr/local/apache2/bin/apachectl restart 重启 要在重启 Apache...

    AI语音机器人安装方法 AI机器人安装代码

    /etc/init.d/bt restart 查看面板入口:/etc/init.d/bt default bt 6修改宝塔账户 bt 5修改宝塔密码 3.登陆宝塔,安装环境 php7.0 nginx mysql 4.安装freeswitch yum install -y ...

    Apache2.4 64位

    64位的windows8系统 安装步骤: 修改httpd.conf配置文件 ...httpd -k start 重启与卸载: #重启服务 httpd -k restart #卸载服务 httpd -k uninstall http://www.apachelounge.com/download/

    标题AI语音机器人安装方法 AI机器人安装代码

    /etc/init.d/bt restart 查看面板入口:/etc/init.d/bt default bt 6修改宝塔账户 bt 5修改宝塔密码 3.登陆宝塔,安装环境 php7.0 nginx mysql 4.安装freeswitch yum install -y ...

    Linux守护进程启动进程健康监测进程

    Linux守护进程启动进程健康监测进程 文件名:start.sh 参数说明: # 应用名(查进程关键字): APP_NAME=smart_school-boot  # 应用端口(健康监测用): APP_PORT=17206  # 应用健康检查URL(健康检查):...

    详解Ubuntu下安装和配置Apache2

    在Ubuntu中安装apache 安装指令: sudo apt-get install apache2 安装结束后: 产生的启动和停止文件是:/etc/init.d/apache2 ...Ubuntu发行版本的主配置文件是:apache2.conf 在apache2.conf引用到了以下文件: #

    Linux安装禅道.docx

    Linux安装禅道 Linux安装禅道是指将禅道项目管理系统安装在Linux操作系统上。以下是安装和配置禅道的详细步骤和知识点: 一、下载安装包 下载安装包命令:wget ...

    AI智能语音机器人代码

    /etc/init.d/bt restart 查看面板入口:/etc/init.d/bt default bt 6修改宝塔账户 bt 5修改宝塔密码 3.登陆宝塔,安装环境 php7.0 nginx mysql 4.安装freeswitch yum install -y ...

    阿里云java源码-webdav-aliyundriver:阿里云盘(https://www.aliyundrive.com/)的webdav

    阿里云java源码 说明:支持阿里Teambition网盘的webdav协议,后续的2.x版本仅支持阿里云盘,不再维护Teambition网盘版本 webdav-aliyundriver 本项目实现了阿里云盘的.../etc/aliyun-driver/:/etc/aliyun-driver/ -e

    spring boot/spring cloud项目启动脚本,默认名称:start.sh

    linux服务器,springboot,spring cloud、spring cloud alibaba等项目启动脚本 下载脚本, 1,上传脚本至jar包同级目录 2,更改脚本: jar包名称 项目文件路径 日志路径(包含日志名称) 脚本已配置好jvm优化...

    RestartAPP.zip

    Android检测app异常崩溃后,重新自启动APP,9.0Android系统是可用的 ~

    palapa web server (PWS)运行于安卓系统的web服务器

    Turn your Android devices into a web and database server with Palapa Web Server, a suite of web developer. This application has been designed for low memory consumption and CPU usage, specially used ...

    MYSQL权限不够解决办法

    mysql报权限错误解决办法mysql报权限错误解决办法

    thinkphp5+layui+GatewayWorker开源多客服系统, 支持多客服 权限管理

    Linux不会的请移步workerman说明文档。 或加QQ群:326842206 目录指向public 后台: http://127.0.0.1/admin.php 账号密码 admin 123456 客户窗口: http://127.0.0.1/chat.php/index/index.html?toid=2 这里的toid...

    windows_远程登录linux桌面.docx

    本文档图文并茂,详细介绍在windows下使用vnc viewer远程连接Linux桌面的主要配置步骤。 Linux: 1.rpm -qa vnc //查看是否安装vnc服务,如果没有安装,可以使用yum,或者rpm进行安装 2.修改配置文件: vim /etc/...

    Ubuntu Debian(NGINX/PHP/MYSQL)快速配置工具LNMP云安装

    Nginx状态管理 /etc/init.d/nginx {start|stop|restart|reload|force-reload|status|configtest}PHP5-FPM状态管理 /etc/init.d/php5-fpm {start|stop|status|restart|reload|force-reload}MySQL状态管理/etc/init.d/...

    PHP队列系统

    (主要提供思路) 简单的队列系统执行队列端 队列服务器采用HTTPSQS 管理: ...启动所有队列:php Kernel/bin/queue.php start 停止所有队列:...停止指定队列:php Kernel/bin/queue.php stop xxxx

    【ASP.NET编程知识】利用docker-compose搭建AspNetCore开发环境.docx

    首先使用 Nginx 代理所有的 Web 程序,这样只需要在主机上监听一个端口就可以了,不污染主机。再组合各 Web 程序、Redis/Memcached、SqlServerOnLinux。 新建目录结构 新建一个目录 sites,所有和集群相关的都放在...

Global site tag (gtag.js) - Google Analytics