Http server start linux

Содержание
  1. ИТ База знаний
  2. Полезно
  3. Навигация
  4. Серверные решения
  5. Телефония
  6. Корпоративные сети
  7. Полезные команды для управления Apache в Linux
  8. Про Linux за 5 минут
  9. Установка Apache Server
  10. Проверка версии Apache
  11. Как запустить, остановить или перезапустить Apache
  12. Подготовка
  13. Запуск, остановка и перезапуск Apache в Ubuntu и Debian
  14. Запуск, остановка и перезапуск Apache на RHEL / CentOS
  15. Выводы
  16. Linux Start an Apache Web Server
  17. Red Hat / RHEL / Fedora / CentOS Linux start an Apache webserver command
  18. Debian / Ubuntu Linux start / stop an Apache webserver command
  19. Generic apachectl / apache2ctl command
  20. Start the Apache httpd daemon. Gives an error if it is already running. This is equivalent to apachectl -k start:
  21. Stops the Apache httpd daemon. This is equivalent to ‘apachectl -k stop’ command:
  22. Restarts the Apache httpd daemon. If the daemon is not running, it is started:
  23. Start / Stop and Restart Apache 2 Web Server Command
  24. Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache
  25. Restart Apache 2 web server, enter:
  26. To stop Apache 2 web server, enter:
  27. To start Apache 2 web server, enter:
  28. A note about Debian/Ubuntu Linux systemd users
  29. CentOS/RHEL (Red Hat) Linux version 4.x/5.x/6.x or older specific commands
  30. CentOS/RHEL (Red Hat) Linux version 7.x or newer specific commands
  31. Alpine Linux start / stop / restart Apache 2 using openrc
  32. FreeBSD Unix users
  33. Generic method to start/stop/restart Apache on a Linux/Unix
  34. Summing up
  35. Ubuntu Linux: Start / Restart / Stop Apache Web Server
  36. Method #1: systemctl command examples
  37. Method #2: /etc/init.d/apache2 command examples
  38. Task: Start Apache 2 Server
  39. Task: Restart Apache 2 Server
  40. Task: Stop Apache 2 Server
  41. Method #3: service command examples
  42. Method #4: upstart command examples
  43. Method #5: apache2ctl command examples

ИТ База знаний

Курс по Asterisk

Полезно

— Узнать IP — адрес компьютера в интернете

— Онлайн генератор устойчивых паролей

— Онлайн калькулятор подсетей

— Калькулятор инсталляции IP — АТС Asterisk

— Руководство администратора FreePBX на русском языке

— Руководство администратора Cisco UCM/CME на русском языке

— Руководство администратора по Linux/Unix

Серверные решения

Телефония

FreePBX и Asterisk

Настройка программных телефонов

Корпоративные сети

Протоколы и стандарты

Полезные команды для управления Apache в Linux

Для работы с веб — приложениями

В этом руководстве мы опишем некоторые из наиболее часто используемых команд управления службами Apache (HTTPD) , которые полезно знать, разработчику или системному администратору, и держать эти команды под рукой. Мы покажем команды для Systemd и SysVinit.

Онлайн курс по Linux

Мы собрали концентрат самых востребованных знаний, которые позволят тебе начать карьеру администратора Linux, расширить текущие знания и сделать уверенный шаг к DevOps

Убедитесь, что следующие команды должны выполняться от имени пользователя root или sudo и работать с любым дистрибутивом Linux, таким как CentOS, RHEL, Fedora, Debian и Ubuntu.

Про Linux за 5 минут

  • Установка Apache Server

    Чтобы установить веб-сервер Apache, используйте ваш стандартный менеджер пакетов, как показано ниже.

    Проверка версии Apache

    Чтобы проверить установленную версию вашего веб-сервера Apache в вашей системе Linux, выполните следующую команду.

    Если вы хотите увидеть номер версии Apache и параметры компиляции, используйте флаг -V, как показано ниже.

    Проверка на ошибки синтаксиса конфигурации Apache

    Чтобы проверить ваши файлы конфигурации Apache на наличие любых синтаксических ошибок, выполните следующую команду, которая проверит правильность файлов конфигурации, прежде чем перезапускать службу.

    Запуск сервиса Apache

    Чтобы запустить службу Apache, выполните следующую команду.

    Включение службы Apache

    Предыдущая команда пока только запускает службу Apache, чтобы включить автозапуск при загрузке системы, выполните следующую команду.

    Перезапуск службы Apache

    Чтобы перезапустить Apache (остановить, а затем запустить службу), выполните следующую команду.

    Просмотр состояния сервиса Apache

    Чтобы проверить информацию о состоянии времени выполнения службы Apache, выполните следующую команду.

    Перезагрузка сервиса Apache

    Если вы внесли какие-либо изменения в конфигурацию сервера Apache, вы можете указать службе перезагрузить свою конфигурацию, выполнив следующую команду.

    Остановка службы Apache

    Чтобы остановить службу Apache, используйте следующую команду.

    Показать справку Apache Command

    И последнее, но не менее важное: вы можете получить справку о служебных командах Apache в systemd, выполнив следующую команду.

    На этом пока все! В этой статье мы объяснили наиболее часто используемые команды управления службами Apache / HTTPD, которые полезно будет знать, включая запуск, включение, перезапуск и остановку Apache.

    Мини — курс по виртуализации

    Знакомство с VMware vSphere 7 и технологией виртуализации в авторском мини — курсе от Михаила Якобсена

    Источник

    Как запустить, остановить или перезапустить Apache

    Apache — это кроссплатформенный HTTP-сервер с открытым исходным кодом. Он обладает мощными функциями и может быть расширен с помощью большого количества модулей.

    Если вы разработчик или системный администратор, скорее всего, вы имеете дело с Apache на регулярной основе.

    Запуск, остановка и перезапуск / перезагрузка являются наиболее распространенными задачами при работе с веб-сервером Apache. Команды для управления службой Apache различны в разных дистрибутивах Linux.

    Большинство последних дистрибутивов Linux используют SystemD в качестве системы инициализации и диспетчера служб по умолчанию. Старые дистрибутивы основаны на SysVinit и используют сценарии инициализации для управления службами. Еще одно отличие — это название сервиса. В Ubuntu и Debian служба Apache называется apache2 , а в системе на основе Red Hat, такой как CentOS, имя службы — httpd .

    В этой статье объясняется, как запустить, остановить и перезапустить Apache в наиболее популярных дистрибутивах Linux.

    Подготовка

    В инструкциях предполагается, что вы вошли в систему как пользователь root или пользователь с привилегиями sudo .

    Читайте также:  Линукс прошивка для роутера

    И служебные блоки SystemD, и сценарий SysVinit принимают следующие аргументы для управления службой Apache:

    • start : start службу Apache.
    • stop : завершает работу службы Apache.
    • restart : останавливает, а затем запускает службу Apache.
    • reload : аккуратно перезапускает службу Apache. При перезагрузке основной процесс Apache завершает дочерние процессы, загружает новую конфигурацию и запускает новые дочерние процессы.
    • status : показывает статус услуги.

    Запуск, остановка и перезапуск Apache в Ubuntu и Debian

    SystemD — это системный и сервисный менеджер для последних выпусков Ubuntu ( 20.04 18.04 ) и Debian ( 10 , 9 ).

    Чтобы запустить службу Apache, выполните следующую команду:

    Чтобы остановить службу Apache, выполните следующую команду:

    Каждый раз, когда вы вносите изменения в конфигурацию Apache, вам необходимо перезапускать серверные процессы. Чтобы перезапустить службу Apache, запустите:

    Более старые (EOLed) версии Ubuntu или Debian используют сценарии init.d для запуска, остановки и перезапуска демона Apache:

    Запуск, остановка и перезапуск Apache на RHEL / CentOS

    Systemd — это системный и сервисный менеджер для RHEL / CentOS 7 и 8 .

    Запустите службу Apache:

    Остановите службу Apache:

    Перезапустите службу Apache:

    Если у вас есть система CentOS 6 или более ранней версии, которая использует SysV, используйте следующие команды для запуска, остановки и перезапуска демона Apache:

    Выводы

    Мы показали вам, как запускать, останавливать и перезапускать веб-сервер Apache в различных системах Linux.

    Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.

    Источник

    Linux Start an Apache Web Server

    Q. How do I start an Apache Web Server under Linux Operating systems?

    A. You can easily start / stop Apache web server using a shell prompt. If your webserver is located in other data center login using ssh and type the following command as per your Linux distribution.

    Red Hat / RHEL / Fedora / CentOS Linux start an Apache webserver command

    Type the following command:
    # /etc/init.d/httpd start
    To stop Apache server, enter:
    # /etc/init.d/httpd stop

    • No ads and tracking
    • In-depth guides for developers and sysadmins at Opensourceflare✨
    • Join my Patreon to support independent content creators and start reading latest guides:
      • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
      • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
      • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
      • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
      • How to protect Linux against rogue USB devices using USBGuard

    Join Patreon

    Debian / Ubuntu Linux start / stop an Apache webserver command

    Type the following command:
    # /etc/init.d/apache2 start
    To stop Apache server, enter:
    # /etc/init.d/apache2 stop

    Generic apachectl / apache2ctl command

    apachectl is Apache HTTP server control interface command, which can be used to stop or start web server under any Linux distribution or UNIX.

    Start the Apache httpd daemon. Gives an error if it is already running. This is equivalent to apachectl -k start:

    Stops the Apache httpd daemon. This is equivalent to ‘apachectl -k stop’ command:

    Restarts the Apache httpd daemon. If the daemon is not running, it is started:

    # apachectl restart
    apache2ctl is for Apache Webserver version 2 and only available under Debian or Ubuntu Linux:
    # apache2ctl start
    # apache2ctl stop
    # apache2ctl restart

    🐧 Get the latest tutorials on Linux, Open Source & DevOps via

    Источник

    Start / Stop and Restart Apache 2 Web Server Command

    H ow do I restart an Apache 2 Web Server under a Debian / Ubuntu / CentOS / RHEL / Fedora Linux or UNIX-like operating systems? Can you tell me command to start or stop Apache 2 web server running on Linux?

    Tutorial details
    Difficulty level Easy
    Root privileges Yes
    Requirements Apache 2 on Linux / Unix
    Est. reading time 3 mintues

    Apache is primarily used to serve both static content and dynamic Web pages on the World Wide Web. Many web applications are designed expecting the environment and features that Apache provides. Apache can be started or restarted using any one of the following methods on Linux or Unix-like systems.

    First, login to your web-server using ssh client, if server is not in your local data center:
    ssh root@your.server.com
    Once logged in type the following commands as per your Linux or Unix variant.

    Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache

    You can either use service or /etc/init.d/ command as follows on Debian Linux version 7.x or Ubuntu Linux version Ubuntu 14.10 or older:

    Restart Apache 2 web server, enter:

    # /etc/init.d/apache2 restart
    OR
    $ sudo /etc/init.d/apache2 restart
    OR
    $ sudo service apache2 restart

    • No ads and tracking
    • In-depth guides for developers and sysadmins at Opensourceflare✨
    • Join my Patreon to support independent content creators and start reading latest guides:
      • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
      • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
      • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
      • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
      • How to protect Linux against rogue USB devices using USBGuard

    Join Patreon

    To stop Apache 2 web server, enter:

    # /etc/init.d/apache2 stop
    OR
    $ sudo /etc/init.d/apache2 stop
    OR
    $ sudo service apache2 stop

    To start Apache 2 web server, enter:

    # /etc/init.d/apache2 start
    OR
    $ sudo /etc/init.d/apache2 start
    OR
    $ sudo service apache2 start

    A note about Debian/Ubuntu Linux systemd users

    Use the following systemctl command on Debian Linux version 8.x+ or Ubuntu Linux version Ubuntu 15.04+ or above:
    ## Start command ##
    systemctl start apache2.service
    ## Stop command ##
    systemctl stop apache2.service
    ## Restart command ##
    systemctl restart apache2.service
    We can view status using the following command:
    $ sudo systemctl status apache2.service

    CentOS/RHEL (Red Hat) Linux version 4.x/5.x/6.x or older specific commands

    ## Start ##
    service httpd start
    ## Stop ##
    service httpd stop
    ## Restart ##
    service httpd restart

    CentOS/RHEL (Red Hat) Linux version 7.x or newer specific commands

    Most modern distro now using systemd, so you need to use the following systemctl command:
    ## Start command ##
    systemctl start httpd.service
    ## Stop command ##
    systemctl stop httpd.service
    ## Restart command ##
    systemctl restart httpd.service

    Alpine Linux start / stop / restart Apache 2 using openrc

    We need to use the service command as root user:
    # service apache2 start
    # service apache2 stop
    # service apache2 status
    # service apache2 restart
    Session:

    FreeBSD Unix users

    FreeBSD user can restart Apache as follows:
    # /usr/local/etc/rc.d/apache22 restart
    # service restart apache22
    # service stop apache22
    # service start apache22

    Generic method to start/stop/restart Apache on a Linux/Unix

    The syntax is as follows (must be run as root user):
    ## stop it ##
    apachectl -k stop
    ## restart it ##
    apachectl -k restart
    ## graceful restart it ##
    apachectl -k graceful
    ## Start it ##
    apachectl -f /path/to/your/httpd.conf
    apachectl -f /usr/local/apache2/conf/httpd.conf

    Summing up

    You learned how to start, stop or restart the Apache 2 web server using command-line over ssh-based session.

    🐧 Get the latest tutorials on Linux, Open Source & DevOps via

    Источник

    Ubuntu Linux: Start / Restart / Stop Apache Web Server

    H ow 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 level Easy
    Root privileges Yes
    Requirements Shell
    Est. reading time 1m
    1. systemctl command – Only works on systemd based Ubuntu like version 16.04 LTS and above.
    2. /etc/init.d/apache2 – A sys v init style script to start / stop / restart the Apache2 service under Debian or Ubuntu Linux.
    3. service command – This command work in most Linux distributions including Debian and Ubuntu.
    4. upstart command – Only works on certain version of Ubuntu.
    5. apache2ctl command – This method should work on all Linux and Unix like operating systems.

    Method #1: systemctl command examples

    To start Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux, type:
    $ sudo systemctl start apache2.service
    To stop Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux, type:
    $ sudo systemctl stop apache2.service
    To restart Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest systemd based Ubuntu Linux, type:
    $ sudo systemctl restart apache2.service
    To status of start/restart/stop operation, enter:
    $ journalctl -u apache2
    To find out whether Apache 2 running or not, enter:
    $ sudo systemctl status apache2.service
    Sample session:

    Fig.01: Ubuntu Linux systemctl start/stop/restart Apache server (systemd)

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

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

    • No ads and tracking
    • In-depth guides for developers and sysadmins at Opensourceflare✨
    • Join my Patreon to support independent content creators and start reading latest guides:
      • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
      • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
      • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
      • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
      • How to protect Linux against rogue USB devices using USBGuard

    Join Patreon

    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 #3: 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 #4: upstart command examples

    The following commands only works with certian version of Ubuntu such as Ubuntu Linux LTS 12.04 and 14.04. 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 #5: 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

    🐧 Get the latest tutorials on Linux, Open Source & DevOps via

    Category List of Unix and Linux commands
    Documentation help • mandb • man • pinfo
    Disk space analyzers df • duf • ncdu • pydf
    File Management cat • cp • less • mkdir • more • tree
    Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
    Linux Desktop Apps Skype • Spotify • VLC 3
    Modern utilities bat • exa
    Network Utilities NetHogs • dig • host • ip • nmap
    OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
    Package Manager apk • apt
    Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
    Searching ag • grep • whereis • which
    Shell builtins compgen • echo • printf
    Text processing cut • rev
    User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
    WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

    Comments on this entry are closed.

    /.bash_profile and add:
    alias apache=’sudo /etc/init.d/apache2′

    Then it’s just apache start, apache restart, etc.

    Thanks for the tip. It worked like a charm.

    These cmd line works great.

    Here is what works for me:

    /etc/rc.d/init.d/httpd (space) start

    /etc/rc.d/init.d/httpd (space) stop

    nice tutorials,
    is there a way to run the apache server as services just like in xampp?
    Thanks,
    man

    wohooooooo. good tutorial . 4 thumbs ^_^

    it s not workin for me….
    the result is
    sudo: /etc/init.d/apache2 commad not found
    pls help me guys

    sudo /etc/init.d/apache2 do not put that column after sudo

    i has stop my apache server, but another connections still establish

    unix 3 [ ] STREAM CONNECTED 14940 /tmp/orbit-username/

    I’m from Brazil, and your tip helped me a lot, thanks!

    sudo service apache2 restart

    Thanks mate! nice and easy ( I like the easy ones!)

    Thanks for the help.

    the amount of times i forget this. sheesh. thanks gzip

    Hi! this tutorial is great. things have been ok but mine didnt work at the configuration stage. i restart the server but this d response:
    Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    … waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    help me pls

    Your can also use this command
    sudo service apache2 restart

    Does the “sudo service apache2” apply for the php cli ?

    PHP Cli uses a different php.ini .

    sudo service apache2 This worked for me, thanks a lot. I had an instance of apache2 running, but it was screwing up apache that was trying to run in xampp.

    Nice tutorial. Help a lot 🙂

    If you get “command not found” then apache2 may have been installed in a non-standard directory. For instance the bitnami installers put it in ‘stack’, so to find the ctl.sh you may need to use

    sudo stack/apache2/scripts/ctl.sh restart

    Whether this actually solves your problem or not, I don’t know, but it doesn’t cause the error.

    Also when using bitnami the command

    sudo stack/ctlscript.sh restart

    restarts every service bitnami installed, including apache, in a logical order.

    Final comment on this: If you are using one of the XAMPP or other stacks that installs apache as part of a larger package, you want to watch the stack-restart command (like the one I gave above for bitnami) very closely and always get the verbose log.

    If you have made some change like blowing away an app directory you aren’t using to fit within tight cloud host requirements, the configuration files generated for apache may be wrong/fragile and may cause apache to just not start with no indication why. However the stack-restart command for the stack you are using will generally report that problem. For instance in bitnami the restart is fragile – unless every single line of the configuration files it is relying on is up to date, you’ll have to go edit them yourself

    sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

    PHP is however more robust and usually only generates a warning if it doesn’t find some app configuration include. The worst you will see from PHP is a line like this

    WARNING: Nothing matches the include pattern ‘/opt/bitnami/apps/limesurvey/conf/php-fpm/pool.conf’ from /opt/bitnami/php/etc/php-fpm.conf at line 17.

    so you can sudo nano that .conf file also, but it might be better to let all future shell users have at least a chance to notice that you blew away an app package and then manually reconfigured. I would leave the warnings in place myself. Your mileage may vary.

    why we have to restart apache server in ubantu

    ## How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04

    $ sudo apt-get update
    $ sudo apt-get install apache2

    Источник

    Читайте также:  Как проверить работу ноутбука windows 10
  • Оцените статью