- Mac OS x Restart Apache Web Server
- Task: Stop Apache Web server
- Task: Start Apache Web server
- Mac OS X Start / Stop / Restart Apache Web Server
- To stop Apache web server, enter:
- To start Apache web server again, enter:
- To restart apache web server, enter:
- To run a configuration file syntax test
- To reload apache web server after editing the config file
- Sample session from above commands
- Where are the Apache Configuration files on Mac? – httpd.conf
- What is Httpd.conf?
- Httpd.conf Location on Mac
- Httpd.conf Location in Mac Finder
- Httpd.conf Location in Mac Terminal
- Can’t Save Httpd.conf?
- Restart Apache to Apply Configuration Changes
Mac OS x Restart Apache Web Server
H ow do I restart Apache web server under Mac OS X operating systems?
The apachectl command act as Apache HTTP Server control interface. It can be used to start, stop, and restart the Apache web server from command line.
Open a terminal and type any one of the following command:
- 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 ➔
Fig.01: Restarting Apache under Mac OS X
Task: Stop Apache Web server
Task: Start Apache Web server
🐧 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.
Thanks, but it might be easier this way: Open the “Sharing” preference, (de-)select “Web Sharing”.
I was just wondering if OS X got some sort of service manager. I need to dig it a little more…
thanks for the comment!
The software to start/stop (load/unload) services is called “launchctl”. From the man page:
launchctl interfaces with launchd to load, unload daemons/agents and generally control launchd. launchctl supports taking subcommands on the command line, interactively or even redirected from standard input.
These commands can be stored in $HOME/.launchd.conf or /etc/launchd.conf to be read at the time launchd starts.
Vivek, what does the -k switch do? I couldn’t find it in the man page for apachectl on a Mac OS X system.
@Robert, I will look into it.
@Leaman, the apachectl command works in two modes:
a) Sys v style mode – One line command mode which take args like start, restart, and stop, and translating them into appropriate UNIX signals to httpd.
b) Traditional UNIX mode with lots of options for testing and debugging. In this mode it can act as a simple front-end to the httpd command that simply sets necessary environment variables and then invokes httpd, passing through any command line arguments.
it does’mt work for me 🙁
sumitgupta$ apachectl -k graceful
httpd: Syntax error on line 488 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+entropy-php.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _libiconv\n Referenced from: /usr/local/php5/lib/libintl.8.dylib\n Expected in: /usr/lib/libiconv.2.dylib\n
SUM-IT:
this is the problem i am facing please help…..
i receive an error when I try to restart apache with: sudo apachectl restart
the error reads: /urs/sbin/apachectL: line 73: unlimit: open files: cannot modify limit: invalid argument
can anyone help! please.
changes are to be made in “/usr/sbin/apachectl”
comment out the these lines.
i did this through the command line using ‘vi’ commands
@Javier, I’d say there is an error in your httpd.conf file. Open it up in the plain-text editor of your choice–one that shows line numbers–and look at line 73. There is either a syntax error or an invalid argument for the option contained on that line.
lemanc,
i went to httpd.conf file and line 73 is ‘LoadModule include_module libexec/apache2/mod_include.so ‘ do you know anything about this kind of issue?
thanks in advanced!
This is not the correct solution. Please see my other reply for the solution.
Источник
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!
Источник
Where are the Apache Configuration files on Mac? – httpd.conf
Here’s where to find httpd.conf on Mac. This is the httpd.conf location on Mac OS X 10.6 Snow Leopard and Mac OS X 10.7 Lion. This article also shows how to make the httpd.conf directory visible in the Mac Finder.
What is Httpd.conf?
Httpd.conf is the Apache web server’s main configuration file. Mac OSX ships with Apache installed. See Apache’s configuration docs for how to configure Apache.
Httpd.conf Location on Mac
On Mac httpd.conf location is in the directory /etc/apache2 . You can access this folder through the Mac Finder or through the Mac Terminal.
Checked on OS X 10.7, 10.6.8, 10.6.7.
Httpd.conf Location in Mac Finder
You won’t normally see even the /etc/apache2 directory showing up in the Mac Finder. I tried looking in Macintosh HD , but /etc doesn’t show up.)
I found a tip at Codejacked on how to open hidden files in the Finder.
Here’s how to view httpd.conf’s directory in the Mac’s finder:
- In the Finder, click the Go menu, and choose Go to Folder…
- Type in /etc/apache2 .
- Click Go.
The Finder will show the apache2 folder, and in it, you’ll see httpd.conf.
Httpd.conf Location in Mac Terminal
You can also get to the httpd.conf file through a terminal session, which is okay if your comfortable in the Unix shell ( bash ):
Can’t Save Httpd.conf?
Httpd.conf is protected by OSX from being edited. If you open it with the TextEdit application for example, you won’t be able to save it. For details to bypass this security, see How to Easily Edit Httpd.conf on Mac.
Restart Apache to Apply Configuration Changes
Don’t forget you will need to restart Apache for your configuration changes in httpd.conf to be applied. To restart Apache on Mac:
- Go to the Apple menu and choose System Preferences.
- Click on Sharing.
- Untick Web Sharing.
- Tick Web Sharing.
Источник