Ubuntu Server Start/stop/restart apache2 Web server

Source: Internet
Author: User

How does I start, restart, or stop Apache 2.x Web server on Ubuntu Linux operating systems using the 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. serviceCommand-this command work on most Linux distributions including Debian and Ubuntu.
  3. upstartCommand-only works on latest version of Ubuntu.
  4. apache2ctlCommand-this method should work on all Linux and Unix like operating systems.
Method #1:/etc/init.d/apache2Command 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:serviceCommand 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:upstartCommand 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:apache2ctlCommand 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

Ubuntu Server Start/stop/restart apache2 Web server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.