Mac os httpd stop

Mac OS X Start / Stop / Restart Apache Web Server

To stop Apache web server, enter:

sudo apachectl stop
OR
sudo apachectl -k stop

To start Apache web server again, enter:

sudo apachectl start
OR
sudo apachectl -k start

To restart apache web server, enter:

sudo apachectl restart
OR
sudo apachectl -k restart

To run a configuration file syntax test

sudo apachectl configtest

To reload apache web server after editing the config file

First edit the config file, run:
$ sudo vi /etc/apache2/httpd.conf
Make changes as per your needs. Close and save the file. To reload new changes, run:
sudo apachectl graceful
OR
sudo apachectl -k graceful

  • 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

Sample session from above commands

Fig.01: apachectl in action on macOS

You can displays a brief status report by visiting the url http://localhost:80/server-status in the web browser of your choice.

🐧 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.

For some interesting reason, apache keeps spawning off new process however I kill it. I tried apachectl and kill -SIGTERM but apache would be killed and another process will be spawned right away.
Can you tell me why?

I have the same problem as you Antony.
I’ve used MAMP and then switched to Mac’s default Apache and problem still exists.
I think it is somehow related to xdebug. I’ll try zend_debugger. If that doesn’t work, I’m switching to another operating system.

in /Applications/XAMPP/xamppfiles/xampp include inicial line sudo apachectl stop

404-not found
could not be satisfied

Use this to stop the apache server
sudo /usr/sbin/apachectl stop

Thank you! I was tinkering around with the built-in Apache web server because I’ll be messing around with learning some HTML and CSS on my own. I found a page explaining how to start and use it, but it didn’t say how to end the process. I didn’t notice any performance change but I also didn’t want wayward processes running on my machine. Many thanks!

Источник

How to stop apache permanently on mac Mavericks?

I’m trying to install zend server on mac and need to uninstall the apache server that is auto included with Mavericks so that the Apache server included with Zend is used instead. Can it be prevented from running on startup or permanently removed?

4 Answers 4

This will stop a running instance of Apache, and record that it should not be restarted. It records your preference in /private/var/db/launchd.db/com.apple.launchd/overrides.plist .

it will stop all

I ran into this same problem, and the culprit was pretty obtuse. It wound up that OSX was attempting to include a nonexistent php version, however the OSX httpd was also not directly accessible due to the homebrew httpd taking priority. Here’s what I did that fixed it:

First: brew unlink httpd Then which httpd revealed the following: /usr/sbin/httpd

At this point I ran sudo /usr/sbin/httpd -k stop , and the real culprit revealed itself:

I then fixed this with sudo vi /private/etc/apache2/httpd.conf , and commented out all of the lines in that file, and ran the following for good measure:

The underlying problem was that the native OSX instance was still running, but had become detached from launchctl due to the PHP not found issue. So basically launchctl thought it had properly shut the process down, but the apachectl agent refused to stop due to the PHP error, resulting in a decoupled process, which was only accessible for direct control when the homebrew version was also unlinked.

Commenting out the native PHP include allowed me to run sudo apachectl -k stop without issue.

Источник

Question: Q: How to «really» stop httpd daemon?

I’ve installed a custom version of Apache2 that I want to run in complete replacement of the system provided one.

I tought it would suffice to stop the http service by the System Preferences but it didn’t work.

What follow is a troubleshooting session I’ve done in an attempt to solve the problem.

I would point out that I’m not an Mac OS X power user.

I was attempting to reconfigure my webserver and I’ve noticed that, even if I killed it (by ps -aux | fgrep apache2 evidence) I had still an httpd process running effectively listening on port 80.

I’ve killed it and I’ve happily noticed that it wasn’t respawn.

I’ve than ran Safari pointing to localhost and noticed it didn’t failed to connect.

Reissued lsof -i | fgrep LISTEN I’ve found some httpd processes were binding the 80 port again.

At this point i know for sure:

  1. «my» apache2 processes aren’t running
  2. system httpd have been started again

Check which was listening by telnet

/System/Library/LaunchDaemons$ telnet localhost 80

Connected to localhost.

Escape character is ‘^]’.

Connection closed by foreign host.

I’ve observed that I didn’t get an HTTP-conform reply but a socket was effectively allocated.

I’ve checked the configuration of /System/Library/LaunchDaemon/org.apache.httpd.plist and found

Disabled

MacBook Pro, Mac OS X (10.7)

Posted on Aug 4, 2011 4:36 PM

Yes, I’m aware of them… simply I didn’t want to incur in such overhead.

Anyway, the problem doesn’t pertain Mac Ports’Apache instance. I was able to control it.

I said «was» because, drastically, I’ve removed Mac Ports (I think it would be better to do things in Mac style on a Mac: learned lesson) and still have the problem: httpd binds on 80 but it doesn’t speak HTTP…

I would thank you for the excellent material you’ve suggested to me, especially for the lectio Googlis by the launchd’s author 🙂… honeslty, the last place where I’d attemped to look.

Thank you for your support, it’s time to study and learn… possibly fix.

Posted on Aug 4, 2011 6:19 PM

All replies

Loading page content

Page content loaded

You didn’t try stopping Apache2 with «apachectl»? Also where did you install your copy of Apache2? /usr/local/apache2, etc.? Where did you obtain the Apache2 version? Did you grab the source from the apache website and complie it or did you use some other method to install it? Are you running it on port 80?

What are you trying to accomplish by installing a custom copy of Apache2? Are you looking to install extra modules etc? Are you trying to setup a development environment?

Aug 4, 2011 4:46 PM

I’ve installed a custom version of Apache2 that I want to run in complete replacement of the system provided one.

I would point out that I’m not an Mac OS X power user.

You are certainly conflicted, that’s for sure.

The «Disabled» key no longer has any meaning. The actual value is stored «elsewhere». Run the following command to permanently disable Apple’s Apache:

sudo launchctl unload -w /System/Library/LaunchDaemon/org.apache.httpd.plist

Now, can I ask why you have installed a custom version of Apache? From the rest of your post, you sure look like a power user to me. It may just be that you are used to doing things the way some «other» operating systems work. If you tell me what your ultimate goal is, perhaps I can tell you a more elegant, Mac-friendly way to achieve it.

Aug 4, 2011 5:00 PM

As I stated above I’ve successfully stopped Apache2 process (which is my custom installation) and incidentally I used apachectl to carry out the job.

I’ve obtained it trhough Mac ports.

I think that the following command will suffice to answer your questions and give some more insight of my disaster 🙂…

/System/Library/LaunchDaemons$ ps ax | egrep ‘(.*httpd.*)|(.*apache.*)’

14063 ?? Ss 0:00.18 /usr/sbin/httpd -D FOREGROUND

14202 ?? S 0:00.00 /usr/sbin/httpd -D FOREGROUND

14343 ?? Ss 0:00.01 /opt/local/bin/daemondo —label=apache2 —start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start ; —stop-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop ; —restart-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart ; —pid=none

14350 ?? Ss 0:00.14 /opt/local/apache2/bin/httpd -k start

14355 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14356 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14357 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14358 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14359 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14375 s000 S+ 0:00.00 egrep (.*httpd.*)|(.*apache.*)

How can I deactivate the daemondo? Where I have to look?

Aug 4, 2011 5:06 PM

/opt doesn’t exist by default on Mac OS X. Mac ports must have installed daemondo along with apache2.

http://guide.macports.org/chunked/reference.startupitems.html sheds more light on it. Mac Ports provides daemondo to assist with handling launchd configurations on Mac OS X for daemons that Mac Ports installs, such as your apache2 installation.

Your answers are to be found in the Mac Ports documentation.

Aug 4, 2011 5:15 PM

I’ve installed a custom version of Apache2 that I want to run in complete replacement of the system provided one.

I would point out that I’m not an Mac OS X power user.

You are certainly conflicted, that’s for sure.

The «Disabled» key no longer has any meaning. The actual value is stored «elsewhere». Run the following command to permanently disable Apple’s Apache:

sudo launchctl unload -w /System/Library/LaunchDaemon/org.apache.httpd.plist

Now, can I ask why you have installed a custom version of Apache? From the rest of your post, you sure look like a power user to me. It may just be that you are used to doing things the way some «other» operating systems work. If you tell me what your ultimate goal is, perhaps I can tell you a more elegant, Mac-friendly way to achieve it.

/System/Library/LaunchDaemons$ sudo launchctl unload -w /System/Library/LaunchDaemon/org.apache.httpd.plist

Sorry, try again.

launchctl: Couldn’t stat(«/System/Library/LaunchDaemon/org.apache.httpd.plist»): No such file or directory

nothing found to unload

ps ax | egrep ‘(.*httpd.*)|(.*apache.*)’

14063 ?? Ss 0:00.18 /usr/sbin/httpd -D FOREGROUND

14202 ?? S 0:00.00 /usr/sbin/httpd -D FOREGROUND

14343 ?? Ss 0:00.01 /opt/local/bin/daemondo —label=apache2 —start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start ; —stop-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop ; —restart-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart ; —pid=none

14350 ?? Ss 0:00.15 /opt/local/apache2/bin/httpd -k start

14355 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14356 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14357 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14358 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14359 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start

14395 s000 R+ 0:00.00 egrep (.*httpd.*)|(.*apache.*)

I was ready to bet you’ve found a solution.

Q. Now, can I ask why you have installed a custom version of Apache?

A. I came from Linux and I have to deploy my software on Linux systems. I was scared to found any kind of difference between the two systems so I’ve decided to build my httpd from scratch and so ensuring that I’d get the same result on both system.

I’ve started experimenting Mac port just to test the replacement procedure of the daemon.

I suppose my mates are right when say that I’m too drastic…

Aug 4, 2011 5:16 PM

Try out http://virtualbox.com/ and simply setup a VM with your exact production Linux system on it. VirtualBox is free and pretty easy to use. It runs on Mac OS X with no trouble. Or you can buy VMWare Fusion or Parallels.

Although Mac OS X is very very Unix like, there are differences such as launchd which uses XML configuration files to define all the parameters for a daemon.

Aug 4, 2011 5:32 PM

Yes, I’m aware of them… simply I didn’t want to incur in such overhead.

Anyway, the problem doesn’t pertain Mac Ports’Apache instance. I was able to control it.

I said «was» because, drastically, I’ve removed Mac Ports (I think it would be better to do things in Mac style on a Mac: learned lesson) and still have the problem: httpd binds on 80 but it doesn’t speak HTTP…

I would thank you for the excellent material you’ve suggested to me, especially for the lectio Googlis by the launchd’s author 🙂… honeslty, the last place where I’d attemped to look.

Thank you for your support, it’s time to study and learn… possibly fix.

Aug 4, 2011 6:19 PM

Apache2 on OSX is simply missing modules and configuration settings that Linux distros include by default.

/etc/apache2 is where the configuration files are.

Aug 4, 2011 6:31 PM

/System/Library/LaunchDaemons$ sudo launchctl unload -w /System/Library/LaunchDaemon/org.apache.httpd.plist

Sorry, try again.

launchctl: Couldn’t stat(«/System/Library/LaunchDaemon/org.apache.httpd.plist»): No such file or directory

nothing found to unload

Sorry about that. I just copied what you had above. That should have been:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

MacOS X is case-insensitive, but not plural-insensitive.

Q. Now, can I ask why you have installed a custom version of Apache?

A. I came from Linux and I have to deploy my software on Linux systems. I was scared to found any kind of difference between the two systems so I’ve decided to build my httpd from scratch and so ensuring that I’d get the same result on both system.

I’ve started experimenting Mac port just to test the replacement procedure of the daemon.

I don’t think that should be an issue. The thing about Linux is that no two versions (or machines) are identical. The Mac Apache is definitely going to be different than the Apache on any given Linux machine, but then so will the Apache on some other Linux machine.

You will have an easier time learning the Mac-specific items if you stick to the Apple builds and work with them until you get stuck. If some module isn’t available on the Mac, it might not be available on your deployment platform either. On Linux, the reverse is more likely, you will build something base on your development environment and then have big problems when some library isn’t available on the deployment environment and, for whatever reason, you can’t install it there. I find it far easier to develop on a Mac and then deploy to Linux.

I suggest avoiding the «ports» tools until you find your way around a bit. Some people swear by them, but I like to have full control of everything I install. I also don’t like the ports tools installing things that I already have. I prefer to «embrace the Mac-ness»

Источник

Читайте также:  Что делать если при запуске компьютера пишет не удается запустить windows
Оцените статью