Apache

Using Lion, my virtual hosts stopped working using MAMP and VirtualHostX. VHX modifies httpd.conf so I used its built-in backup feature before making changes but when I restored the backup nothing changed. My guess is the httpd.conf file is a mess so maybe the best option is to get back to the Apache default factory settings but I don’t know how to do that. I’m hoping it’s possible and that things aren’t completely hosed. Ideas?

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Try this, first, to get a hint what the issue is:

sudo apachectl configtext

Then see what Apache is borking on. As far as I know, it’s pretty
normal Apache2 and there’s nothing fussy going on, but I haven’t used
it first-hand myself.

Walter

On Sep 13, 2011, at 1:13 AM, Todd wrote:

Using Lion, my virtual hosts stopped working using MAMP and
VirtualHostX.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I guess it all depends on what Apache services you are using but since you made it to Lion you are only $50 away from Lion Server.

The only giant problem with Apple Servers is their lack of DNS so if you have other machines doing DNS and rDNS you could easily try Lion Server. Yes I know you will see DNS inside Lion Server but it is the caching version only and only answers to computers on the same subnet so it is a waste of time and energy.

There is a steep learning curve as with any Server product. If you do decide to try Lion Server may I suggest you try it stock without the optional Server Tools (2nd download free from Apple Support site). If you are familiar with Snow Leopard or Leopard servers you may want the optional tools.

Another good combination is Parallels 6 or the newly release Parallels 7 along with 64bit Ubuntu Server and install WebMin on the Ubuntu Server and you have a fairly good start. Ubuntu is not for the faint of heart, but it is free. I tried VirtualBox with 32bit Ubuntu Server and it croaked under moderate load so I give VirtualBox a two thumbs down rating.

Dale Josephson
Dale Josephson Consulting
Apple Developer & Support

On Sep 12, 2011, at Monday10:13 PM, Todd wrote:

Using Lion, my virtual hosts stopped working using MAMP and VirtualHostX. VHX modifies httpd.conf so I used its built-in backup feature before making changes but when I restored the backup nothing changed. My guess is the httpd.conf file is a mess so maybe the best option is to get back to the Apache default factory settings but I don’t know how to do that. I’m hoping it’s possible and that things aren’t completely hosed. Ideas?

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

sudo apachectl configtext

Walter,

Here’s what was returned. I’m not sure if there’s anything amiss or not.

Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
[-C “directive”] [-c “directive”]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
Options:
-D name : define a name for use in directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C “directive” : process directive before reading config files
-c “directive” : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry, typo on my part: configtest not configtext.

Walter

On Sep 13, 2011, at 1:19 PM, Todd wrote:

sudo apachectl configtext

Walter,

Here’s what was returned. I’m not sure if there’s anything amiss or
not.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry, typo on my part: configtest not configtext.

On a side note:

I found the httpd.conf file in /etc/apahe2/ which I presume controls the default OS X system install. Out of curiosity, using a diff app I compared the current file with httpd.conf.default (in the same directory) and there were a load of differences, though I can’t say if they are problematic. My question is: If httpd.conf.default is the default Apache configuration then would replacing the current file with the default version get me back to a “clean” Apache system setting?

Ok, now the Terminal stuff:

httpd: Could not reliably determine the server’s fully qualified domain name, using My-MacBook.local for ServerName
[Tue Sep 13 13:34:07 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
Syntax OK


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Sep 13, 2011, at 2:43 PM, Todd wrote:

Sorry, typo on my part: configtest not configtext.

On a side note:

I found the httpd.conf file in /etc/apahe2/ which I presume controls
the default OS X system install. Out of curiosity, using a diff app
I compared the current file with httpd.conf.default (in the same
directory) and there were a load of differences, though I can’t say
if they are problematic. My question is: If httpd.conf.default is
the default Apache configuration then would replacing the current
file with the default version get me back to a “clean” Apache system
setting?

It’s the default as shipped by Apache, not as shipped by Apple. You’re
going to have to go back through Time Machine or look at a different
(vanilla) Mac to see what the real differences are.

Ok, now the Terminal stuff:

httpd: Could not reliably determine the server’s fully qualified
domain name, using My-MacBook.local for ServerName
[Tue Sep 13 13:34:07 2011] [warn] NameVirtualHost *:80 has no
VirtualHosts
Syntax OK

If it made it all the way to Syntax OK, then you should see something
(probably the default X screen) when you visit http://localhost/ in
your browser.

If you don’t, then you need to look carefully at the error you get
instead. If it says that “there is no server at this address”, then
your Web Sharing is likely turned off in System Preferences, or
blocked by your Firewall settings. If it shows you a 404, then look to
see if there is an index.php in the /Library/WebServer/Documents
folder (not sure if that file is still there in Lion, my beloved has
her MacBook Pro with her, or I’d check for you).

It’s possible that Lion (non-server) is rigged to only do the personal
Web sharing, as in http://localhost/~todd/, rather than the whole-
machine-as-server with the /Library-level site root. No way to say at
this point.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If it made it all the way to Syntax OK, then you should see something (probably the default X screen) when you visit http://localhost/ in your browser.

If you don’t, then you need to look carefully at the error you get instead. If it says that “there is no server at this address”, then your Web Sharing is likely turned off in System Preferences, or blocked by your Firewall settings. If it shows you a 404, then look to see if there is an index.php in the /Library/WebServer/Documents folder (not sure if that file is still there in Lion, my beloved has her MacBook Pro with her, or I’d check for you).

  • http://localhost yields, “Can’t connect to server at localhost”.
  • There is no “index.php” in /Library/WebServer/Documents, only “index.html.en”.
  • Opening the index file in the Sites folder works but it shows <file:///Users/Home/Sites/index.html>, not “localhost”.
  • Web Sharing is enabled.

When you’re able to, if you can copy the untouched default Apple httpd.conf from the MBP then maybe I’ll just overwrite my current file. Assuming that won’t muck things up any more than they are. Unfortunately Time Machine is not an option and my current external backup no longer has a pristine version of that file.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That sounds normal, actually. There wouldn’t be any php in a vanilla
Mac, just HTML. The .en part is for internationalization. Try toggling
Web Sharing off and back on. Or try this in Terminal:

sudo apachectl stop
sudo apachectl start

wait and watch what happens after that second line. It may say that
the service couldn’t start for some reason or another, or that there
was already a server at that port, or something else meaningful.

Walter

On Sep 13, 2011, at 3:28 PM, Todd wrote:

  • There is no “index.php” in /Library/WebServer/Documents, only
    “index.html.en”.

dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Try toggling Web Sharing off and back on. Or try this in Terminal:

sudo apachectl stop
sudo apachectl start

I was mistaken, Web Sharing is disabled. It was never enabled and things were working correctly a couple days ago.

When I tried the first command above I get this:

launchctl: Error unloading: org.apache.httpd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It sounds like Apache was running from some other location, like maybe
a compiled version in /usr/local/bin, or something like that. Try this
command, and see what you find:

which httpd

The Apple httpd is always in /usr/sbin/httpd, if you see it somewhere
else, then your path may be set to pick up a different one, and it may
be running.

ps aux

…in a very large Terminal window, will show you all running
processes. You can see where the process was called from. Apache
usually runs 2 - 10 copies of itself, but the first one is the one to
look for, it will be started by root. All the copies will be running
under _www.

Walter

On Sep 13, 2011, at 4:26 PM, Todd wrote:

Try toggling Web Sharing off and back on. Or try this in Terminal:

sudo apachectl stop
sudo apachectl start

I was mistaken, Web Sharing is disabled. It was never enabled and
things were working correctly a couple days ago.

When I tried the first command above I get this:

launchctl: Error unloading: org.apache.httpd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yep, I get /usr/sbin/httpd and nothing else.

I see a lot of different “root” processes. Is there something specific to Apache I should look for?

T.

The Apple httpd is always in /usr/sbin/httpd, if you see it somewhere else, then your path may be set to pick up a different one, and it may be running.

You can see where the process was called from. Apache usually runs 2 - 10 copies of itself, but the first one is the one to look for, it will be started by root. All the copies will be running under _www.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Anything with httpd in its line.

marvin:~ waltd$ ps aux | grep httpd | grep -v grep
_www       131   0.0  0.0  2712336    100   ??  S     3Sep11    
0:01.91 /usr/sbin/httpd -D FOREGROUND
root        26   0.0  0.0  2712336   1072   ??  Ss    3Sep11    
0:15.38 /usr/sbin/httpd -D FOREGROUND

This tells me that there is the one root process, and one listener
running as _www (this is a 10.5.8 machine BTW). Out there on the
right, I can see that they are both running from /usr/sbin/httpd. If
this was a server, and was busy, I would expect to see dozens of other
processes running httpd as _www. Note the great disparity of process
IDs – this tells me that the root process started weeks ago when I
started the Mac up, and has been running since. The _www one is
considerably higher, but not that high. Again, if the server was busy,
I would see more, and higher number processes, because Apache starts
and stops listeners as needed, and the OS never recycles process IDs.

Walter

On Sep 13, 2011, at 11:25 PM, Todd wrote:

Yep, I get /usr/sbin/httpd and nothing else.

I see a lot of different “root” processes. Is there something
specific to Apache I should look for?

T.

The Apple httpd is always in /usr/sbin/httpd, if you see it
somewhere else, then your path may be set to pick up a different
one, and it may be running.

You can see where the process was called from. Apache usually runs
2 - 10 copies of itself, but the first one is the one to look for,
it will be started by root. All the copies will be running under
_www.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

ps aux: This can’t be good, I see nothing with httpd.

I replaced the httpd.conf file in /etc/apache2/ with the clean version you sent and tried starting MAMP again. This time it shows Apache as having started (though I doubt that’s the case) but MySQL flat-out refuses to. There are numerous reports of this on the MAMP forum having to do with Lion but none of the fixes has done anything for me. Very discouraging. Until I can find a solution I’m genuinely screwed since the majority of my client work (which I’m in the middle of) is dependent on MySQL to some extent which means I will now have to work directly on the live server and that’s the last thing I want to do, for obvious reasons.

Anything with httpd in its line.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I know little or nothing about MAMP – I’ve never used it personally
– so I can’t tell you any further where to look. I am imagining that
it might be hiding the Apache process within its own signature, and
not actually running it as a separate process on your Mac. If that’s
the case, then you’re kinda stuck. If you can get to the folder where
the MySQL files are stored, then you could quite easily tar them up,
move them to a different server, and run them there. Shouldn’t take
more than half a day to get running on a staging server at Linode or
similar, and those are priced to move. If you have another Mac in the
house, even one quite shockingly old, you may also be able to put
everything on there using relatively stock “Apple Web Sharing” Apache,
which is just ordinary Apache, after all. Marc Liyanage’s[1] PHP
installer will get that going for you in about 20 minutes on most any
Mac, and the MySQL developer site has binary downloads for most
versions of Mac OS X and related hardware architectures.

Walter

  1. http://www.entropy.ch/software/macosx/
  2. http://dev.mysql.com/downloads/

On Sep 14, 2011, at 10:25 AM, Todd wrote:

ps aux: This can’t be good, I see nothing with httpd.

I replaced the httpd.conf file in /etc/apache2/ with the clean
version you sent and tried starting MAMP again. This time it shows
Apache as having started (though I doubt that’s the case) but MySQL
flat-out refuses to. There are numerous reports of this on the MAMP
forum having to do with Lion but none of the fixes has done anything
for me. Very discouraging. Until I can find a solution I’m genuinely
screwed since the majority of my client work (which I’m in the
middle of) is dependent on MySQL to some extent which means I will
now have to work directly on the live server and that’s the last
thing I want to do, for obvious reasons.

Anything with httpd in its line.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m getting ready to wipe the drive and do a clean Lion install. See you on the other side.

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Think long and hard about re-installing MAMP when you do that. I have gotten a lot of mileage out of the Apache2 that ships with the OS.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, that was painless (and quick).

Truthfully I don’t think MAMP was the problem. More likely it was the other app I use in conjunction with MAMP to manage the virtual hosts (I use the free version of MAMP which doesn’t have those tools by default). But, I could be wrong, and frequently am.

I have (under Leopard) used Marc’s tutorials to compile all this stuff manually but I just can’t get my head around how to pull it all together and put it all into practice the way I can with a bundled package like MAMP. It’s a little too much geek and not enough GUI for me. MAMP and similar may not be ideal but having it all neatly bundled is (for the moment) easier for me to manage. But that may change eventually.

Thank you for all your help.

Think long and hard about re-installing MAMP when you do that. I have gotten a lot of mileage out of the Apache2 that ships with the OS.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Todd,
I’ve been using VirtualHostX version 2.1 for a while now and it appears to be quite stable. After seeing this thread earlier in the week I foolishly updated it to the latest version (2.8.4) where it instantly started complaining about a corrupt config file. Needless to say that I used Time Machine to step back to the older app and made a note not to go there again!
Regards,
Tim.

On 15 Sep 2011, at 00:50, Todd wrote:

Truthfully I don’t think MAMP was the problem. More likely it was the other app I use in conjunction with MAMP to manage the virtual hosts (I use the free version of MAMP which doesn’t have those tools by default). But, I could be wrong, and frequently am.

FreewayActions.com - Freeware and commercial actions for Freeway Express & Pro.

Protect your mailto links from being harvested by spambots with Anti Spam.
Only available at FreewayActions.com

http://www.freewayactions.com


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hey Tim,

[Laughs] A little unnerving, isn’t it?

I was using VHX v1 with MAMP 1 without issue for a long time. Then MAMP 2 came along and I upgraded but was having issues with it and Lion so I reverted to v1. Then VHX 3 was released and that’s when things went sideways. But to be fair I can’t say definitively VHX was the cause (I can’t rule out operator error).

Having done a clean install of Lion (unlike my original upgrade) MAMP 2 is working flawlessly. I haven’t reinstalled VHX yet (any version), I’m a bit nervous, but I was planning on getting MAMP Pro anyway so that would negate the need for VHX.

Todd

I’ve been using VirtualHostX version 2.1 for a while now and it appears to be quite stable. After seeing this thread earlier in the week I foolishly updated it to the latest version (2.8.4) where it instantly started complaining about a corrupt config file. Needless to say that I used Time Machine to step back to the older app and made a note not to go there again!


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options