I have mac OS X and would like the built-in apache webserver to run. So I open up "System Preferences", click on "Sharing" and enable "Web sharing". Web server starts (apparently) and the system displays two links which I can use. One is just my ip and the other is my ip/username. Both links just result in "no connection" error in the browser. It doesn't appear to reach apache at all, like apache isn't running.
So I open up terminal and enter:
ps aux | grep apache
no apache process found. I then try the following command:
netstat -ln | grep ':80 ' | grep 'LISTEN'
and nothing is returned. So it appears apache isn't running.
Why would the system preference tell me otherwise? And how can I fix it?
I would use Terminal (/Applications/Utilities), and then try to start apache from the command line.
Try this to help debug:
sudo bash -x /usr/sbin/apachectl -k start
when it is dying silently. Also, check the error_log at:
/var/log/apache2/error_log
You can use TextEdit for the error_log, if you feel more comfortable with a GUI text editor.
Let me know how it goes!
Have had similar problem on a (by now rather old) Macbook still running SL.
Looking at the log, per previous answer, revealed an error loading mod_hfs_apple.so from /usr/libexec/apache2. Checking this, there was no such file in that folder. I copied the file from my other Mac (running Lion, not Snow Leopard) and hey presto the sudo restart command got the server going.
Related
I am trying to run any GUI container I can on MacOS. With every container I try (firefox, chrome, tor, spotify, etc) I always get the error Error: cannot open display. And it's not specific to the docker run command where I pass the environment flag with my $DISPLAY. When I try to run xhost + I get the same error.
I have a fresh XQuartz installation. It is up and running. I have turned on "allow connections from network" under security. I've tried building my own images and pulling jessie frazelle's images. I do not suspect it is a docker issue or the Dockerfiles. It is something on the host, my laptop. I can't seem to figure out what it is.
MacOS Sierra 10.12.5
Docker 17.12.0 Stable
XQuartz 2.7.11 (xorg-server 1.18.4)
My local's $DISPLAY is set to :0.0
So I finally got this to work. And it seems it was pretty simple. I am not certain how this actually fixes the issue, but now the containers work.
How I fixed it was opening up XQuartz and then opening up the "Terminal" app from the "Applications" menu. Then running the command export DISPLAY=192.168.1.X:0, then xhost +. It outputted something like this "access control disabled, clients can connect from any host". After that I was able to run my docker run commands to launch the desired GUI containers.
I am still uncertain how this works and not running them from my laptops Terminal app, but it worked. It must be something I have set in my local env. Hopefully this helps someone else out who may be running into the same issues.
Based on #Byron's answer, I've found out that I could get it to work by running these 2 commands in the normal terminal:
export DISPLAY=:0
/opt/X11/bin/xhost +
I'm using
mac OS 1.8.3
RVM 1.19.6
Ruby ruby 1.9.3p327
Apache 2.4
Phusion Passenger 3.0.19
After an error free install of Apache I launched the server and it worked.
I wrote a 'start_apache.sh' script:
#!/bin/bash
sudo /usr/local/apache2/bin/apachectl -k start
... which worked.
I then installed phusion passenger without error.
When I ran my start_apache.sh script, I got this error
httpd: Syntax error on line 504 of /usr/local/apache2/conf/httpd.conf:
Cannot load
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
into server:
dlopen(/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so,
10): Symbol not found: _unixd_config\n Referenced from:
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so\n
Expected in: flat namespace\n in
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
After following ++ a lot ++ of 'Can't loadModule' Q&A's, I tried
cd /usr/local/apache2/bin
sudo apachectl -k start
... and it worked.
Using the script still does not.
Can someone explain why?
Many thanks!
Maybe it has to do with the working directory. Try this:
#!/bin/bash
cd /usr/local/apache2/bin/ && sudo ./apachectl -k start
Maybe this is some issue with user profile. Could you check environmental paramentrs values?
Thank you rzymek.
Your insight lead me to try this:
perrys-MacBook-Pro:bin perry_mac$ ls
ab apxs dbmmanage envvars-std htcacheclean htdigest httpd logresolve
apachectl checkgid envvars fcgistarter htdbm htpasswd httxt2dbm rotatelogs
perrys-MacBook-Pro:bin perry_mac$ pwd
/usr/local/apache2/bin
perrys-MacBook-Pro:bin perry_mac$ which apachectl
/usr/sbin/apachectl
perrys-MacBook-Pro:bin perry_mac$
Here's what happened: I downloaded, built, and installed apache 2.4. Did not know mac OSX 10.8.3 still had a working apache installation. I had read some web posts about how Apple had "removed web sharing" from this OS version. Turns out that means they removed a GUI element, but left the server in place. As you can see, I now have two versions of apachectl and httpd. I am untangling the rest of the mess now. As a follow-up, if anyone has advice on how to best proceed, please comment below. Otherwise I am going to start by modifying $PATH and see how that goes.
ADDENDUM:
Looks like this lead to a component of my confusion:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_phusion_passenger_is_using_the_wrong_apache_during_installation
... but the link leads to no remedy (as of 5/5/2013). There must be an option to set during the phusion passenger installation to ensure it points to the desired apache installation, but I can't locate it.
In the end, I removed the ver 2.4 of apache that I built and reverted to the ver 2.2 that is included with the OS. So far, it's all working.
I am trying to run a simple hello world script as CGI (from the Beginning Perl book).
i am running to the following problems:
I do not find a folder /cgi-bin/ at any place on my computer (Mac OSX Lion).
I did try changing mode to 755 and any thing i found on the web.
when I try the localhost, I get "it works!" (this means the apache is working o.k)
I saw some advice on changing configurations on apache files and there are confusing
never the less i did try and all did not work.
for instance, the advice to check and uncheck the web button in sharing does no work in
mac osx lion, there isn't a button of that kind any more.
Is it possible to get a step by step guide or help on what to do from the Perl script to actually running it on the web server?
i do not find a folder /cgi-bin/ at any place on my computer (mac osx lion).
You can create one.
The Apache manual describes how to configure it for executing CGI.
when i try the localhost , i get "it works!" (this means the apache is working o.k)
You need to use the URI to the CGI script rather than the Apache root.
i sow some advice on changing configurations on apache files and there are confusing never the less i did try and all did not work. for instance, the advice to check and uncheck the web button in sharing does no work in mac osx lion, there isn't a button of that kind any more.
Apple did remove the GUI option. Instead of using it, fall back to the command line:
apachectl restart
It is usually a good idea to first check your config file edits with:
apachectl configtest
Today I updated to OS X Mountain Lion. I noticed that Apache won't start in MAMP. Nothing new seems to be in the apache log file. Running sudo apachectl -k start in Terminal gives me this:
httpd: Could not reliably determine the server's fully qualified domain name, using Ryan-Smiths-MacBook.local for ServerName
I do have ServerName defined in my httpd.conf file.
I also noticed that "Web sharing" is no longer in the Settings pane... weird.
Any Ideas?
Thanks!
Hi Ryan we had this problem
It turns out the systems own apache is running. We've documented it here http://support.servertastic.com/mamp-not-starting-after-upgrade-to-mountain-lion/
Cheers
Richard
To fix the problem, and to start MAMP apache, you can now refer to: (the above link is broken now.)
https://support.servertastic.com/mamp-not-starting-after-upgrade-to-mountain-lion/
Or simply run the following command:
sudo apachectl stop
In addition if you run into trouble where your mysql no longer will start, try killing the mysql process that may already be running by doing the following:
Open up the program called "Activity Monitor" on your Mac.
Search for a process called “mysqld“.
Click on that process and “Quit Process”
Credits:
http://eliteeternity.com/mysql-server-wont-start-mamp-red-light-mac/
http://forum.mamp.info/viewtopic.php?f=6&t=6149
In MAMP PRO 2.1.1, click Tools > Quit Built-in Apache.
I was able to solve this running OS X 10.8.4 by opening up Activity Monitor, choosing "All Processes" then killing any with "httpd" in the title. After that I was able to start MAMP and both the MYSQL and Apache servers gave the green light!
this one fix my MAMP
Just navigate to /Applications/MAMP/bin/apache2/bin using Finder, and rename envvars to _envvars (yes, just add the underscore). Boom! Done and done.
from codesoap
Had the same problem; no other tricks helped. I found I had an instance with "allow from 127.0.0.1" – removing the IP did the trick. Don't know why.
http://cl.ly/image/253g1L1W472z
The problem with OSX Mountain Lion is that /usr/lib/libpq.5.3.dylib does not exist, but /usr/lib/libpq.5.dylib does.
To fix the issue, open terminal and:
~# sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib
just try to modify mamp in httpd.conf with:
LoadModule php5_module /Applications/MAMP/bin/php/php5.5.3/modules/libphp5.so
My solution to the similar problem. I.e. MySQL was running fine from MAMP manager utility. Apache server did not and the "Open start page" was greyed i.e. not working.
It seems that my problem was, that the Apache server was not for one reason or another able to access it's log file apache_error.log in /Applications/MAMP/logs folder. The file seemed to be somehow "stuck" i.e. I was not able to change the access rights to the file with chmod command. Only after I deleted the log file completely and then restarted the MAMP control utility and started there the MySQL and Apache again, everything worked fine.
BR,
Janne
Had the same problem.
I then set the ServerName to localhost and the Listen port to 8080, because 80 was somehow not available (even not as sudo). In my case it seems to have fixed the problem.
If nothing works for you like me, the problem is likely that you ran your MAMP update with MAMP running, then you closed the existing MAMP without stopping your server. All you need to do is restart your machine.
I am using Mac OS X 10.7.3. I installed tomcat6 via macports 2.0.4. I put the tomcat6 location in myeclipse for spring 10 server configuration. Everything was fine so far.
Then I tried to start it in myeclipse. It could not start, saying something like 8080 port is already in use.
Then I went to terminal.
ps aux | grep tomcat
4 process showed up. It seemed tomcat6 started automatically after the installation. Then I tried to stop it with
sudo tomcatctl stop
Here came the problem. No matter how I tried, it always says
Stopping Tomcat...(pid ****)............... giving up.
I tried to kill the process but it kept starting tomcat again right after the kill.
How do I stop it and let myeclipse take over it? Any help is appreciated.
Thanks,
Milo
try doing sudo port unload tomcat6
This command replaced interacting with launchctl yourself, but im unsure if it supports a -w switch which would typically remove the launch daemon were it used with launchctl unload meaning you wouldnt run into the magic restart problem.