ubuntu server start/stop/restart apache2 web server

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

时间: 2024-10-14 10:56:49

ubuntu server start/stop/restart apache2 web server的相关文章

ubuntu curl upload file to apache2 server

ubuntu curl upload file to apache2 server Table of Contents 1. install 2. get web info 3. set php upload conditions 3.1. ref 3.2. upload_max_fileszie 3.3. post_max_size 3.4. max_execution_time cfg 3.5. restart after cfg 4. config upload directory 5.

How to Install Laravel with an Nginx Web Server on Ubuntu 14.04(Composer,laravel,nginx)

http://ubtutorials.com/tutorial/441/how-install-laravel-nginx-web-server-ubuntu-1404 https://github.com/huanghua581/laravel-getting-started/wiki/Ubuntu-14.04-%E4%B8%8A%E4%BD%BF%E7%94%A8-Nginx-%E9%83%A8%E7%BD%B2-Laravel http://www.ahlinux.com/ubuntu/2

基于raspberry搭建个人web server

树莓派系统介绍 安装操作系统及网络\远程控制配置 安装常用软件 构建web服务器(nginx + php + sqlite) 构建web服务器(appach+mysql+php) 构建NAS服务器 其余功能环境开发 -- 树莓派介绍 1.1    项目介绍 1.2    硬件介绍 1.2.1          散热片安装 1.2.2          风扇安装 附件1 1.2.3          屏幕安装 1.3    系统介绍 目前很对公司或组织都为树莓派开发了操作系统,常用的操作系统如下,

ubuntu16.04-x64系统中Jexus web server部署.NetCore和端口分析引发的猜想!

您有这样的牢骚么? 有一周没更新博客了,简单说下在干什么吧:主要是公司安排对接某旅游大公司的接口,接口数量倒也就10个左右,对接完后还需要加入到业务系统中和App端,因此还是需要花点时间的:时间上来说业务需求安排在6月最后一周上线,整个3周的时间,就本人一人负责,由于在这之前对接过另外一个公司接口,我已经搭建好了整体架构和提供给app端接口了,因此主要还是对接某公司接口而已,至于细节上的东西改改后台系统,调调数据格式应该就差不多了:就本人开发的熟练度来讲一周时间基本能搞定,其他剩余时间就测试,喝

Setting up Django and your web server with uWSGI and nginx

https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user who wants to set up a production web server. It takes you through the steps re

小测几种python web server的性能

http://blog.csdn.net/raptor/article/details/8038476 因为换了nginx就不再使用mod_wsgi来跑web.py应用了,现在用的是gevent-wsgi,效果还不错.但还是想试试别的,比如传说中超级猛的meinheld什么的. 软硬件环境 硬件: 一台04年初购置的IBM X235服务器,CPU为Xeon 2.4G两颗,内存1G,100M网卡. 软件: Ubuntu Server 10.04 LTSApache 2.2.14Nginx 0.7.

jexus asp.net Linux Web Server

Jexus简介 Jexus web server for linux 是运行在Linux上的Web服务器.其安装和部署及其简单,直接支持Asp.net . 下载Jexus wget http://linux.j66.net/down/jexus-5.0.2.tar.gz 然后解压: tar -zxv -f jexus-5.0.2.tar.gz 打开readme.txt 文件查看详细的安装.配置说明: 安装Jexus jexus 基本无需安装,只需要解压,然后注册一下全局程序集即可. 1)新建一个

禁掉Apache web server签名 How to turn off server signature on Apache web server

有的时候,我们为了从安全角度考虑,防止黑客恶意攻击,我们会隐藏掉server信息,比如,一般我们会发现如下信息. 我用的是centos (fedora, RHEL也一样) $ sudo vi /etc/httpd/conf/httpd.conf 其他的系统(ubuntu, Debian) $ sudo vi /etc/apache2/apache2.conf 我们可以在这个文件中添加两行信息 ServerSignature Off //隐藏Apache版本信息 ServerTokens Prod

[r]Setting up Django and your web server with uWSGI and nginx

Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user who wants to set up a production web server. It takes you through the steps required to set up Django so that it works nicely with uWSGI and nginx. I