Last modified by Aaron Rosenzweig on 2011/05/09 01:46

From version 32.1
edited by David Holt
on 2008/10/29 12:33
Change comment: There is no comment for this version
To version 43.1
edited by Kieran Kelleher
on 2007/10/18 08:27
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.dholt
1 +XWiki.kieran
Content
... ... @@ -6,7 +6,7 @@
6 6  
7 7  When you turn on your web server, Apache will listen on the network interfaces that were configured when it starts. If you change networks, you may need to manually restart apache. You can do this by either stopping and restarting Personal Web Sharing, or you can run "apachectl restart" from the commandline as the root user. Because this can get annoying if you are working on a laptop, or periodically using VPN's, there are a couple ways to make this process easier.
8 8  
9 -= Optional Extra Configuration: Explicitly Setting Your Hostname =
9 += Restarting Apache Fix #1: Explicitly Setting Your Hostname =
10 10  
11 11  {{info title="Useful Information"}}
12 12  
... ... @@ -24,7 +24,7 @@
24 24  
25 25  {{/warning}}
26 26  
27 -Edit **/etc/httpd/httpd.conf**, find the line containing **ServerName** and change it to this. If you use Leopard (OS X 10.5), the file is at **/etc/apache2/httpd.conf**.
27 +Edit **/etc/httpd/httpd.conf**, find the line containing **ServerName** and change it to this:
28 28  
29 29  {{code}}
30 30  
... ... @@ -32,50 +32,10 @@
32 32  
33 33  {{/code}}
34 34  
35 -That line may be commented out by default. You can simply uncomment it (remove the leading pound sign). You will also need to find this block
35 +That line may be commented out by default. You can simply uncomment it (remove the leading pound sign) and then restart apache:
36 36  
37 37  {{code}}
38 38  
39 -# First, we configure the "default" to be a very restrictive set of
40 -# features.
41 -#
42 -<Directory />
43 - Options FollowSymLinks
44 - AllowOverride None
45 - Order deny,allow
46 - Deny from all
47 -</Directory>
48 -
49 -{{/code}}
50 -
51 -And modify like so:
52 -
53 -{{code}}
54 -
55 -# First, we configure the "default" to be a very restrictive set of
56 -# features.
57 -#
58 -<Directory />
59 - Options FollowSymLinks
60 - AllowOverride None
61 -# Order deny,allow
62 -# Deny from all
63 -</Directory>
64 -
65 -{{/code}}
66 -
67 -Got to the very end of **/etc/apache2/httpd.conf** and add :
68 -
69 -{{code}}
70 -
71 -Include /System/Library/WebObjects/Adaptors/Apache2.2/apache.conf
72 -
73 -{{/code}}
74 -
75 -Then restart apache:
76 -
77 -{{code}}
78 -
79 79  sudo apachectl restart
80 80  
81 81  {{/code}}
... ... @@ -114,7 +114,6 @@
114 114  or
115 115  
116 116  restart wotaskd and womonitor with launchctl if your WebObjects install launches that way.
117 -(In 10.5 it appears to be necessary to launch with launchctl. See [[Running Monitor and wotaskd on Mac OS X 10.5 "client">>WO 5.4 Getting Started||anchor="javamonitor"]]
118 118  
119 119  == Finally, Configure your Application ==
120 120  
... ... @@ -133,15 +133,10 @@
133 133  
134 134  You may want to set this in your global WOLips settings so you don't have to set it every time you make a new launch configuration. You will need to go back and modify existing launch configurations with these settings even if you set it globally. Global settings only apply to newly created launch configurations.
135 135  
136 -= Apache Restart =
95 += Restarting Apache Fix #2: Kickstart =
137 137  
138 -{{info title="Why would I need this?"}}
97 +The alternative way to restart apache is to have a script run any time your network changes. It turns out that OS X supports such a capability already via Kickstart.
139 139  
140 -If you have a laptop and you get an "Application cannot be found" or some such error in the browser after auto-switching networks (for example going from a work network to a home network), restarting apache can resolve the error condition most of the time. A script is shown below to do that.
141 -If you already implemented the "localhost" explicit hostname setup above, then you will probably not need to bother with this section.
142 -
143 -{{/info}}
144 -
145 145  == Making a restart script ==
146 146  
147 147  Create a script named /usr/local/bin/restartApache and set the contents to:
... ... @@ -154,3 +154,47 @@
154 154  /usr/sbin/apachectl start
155 155  
156 156  {{/code}}
111 +
112 +== Modifying Kicker ==
113 +
114 +1. Edit /System/Library/SystemConfiguration/Kicker.bundle/Contents/Resources/Kicker.xml
115 +1. At the end of the <array> section, add the following block of XML:
116 +
117 +{{code}}
118 +
119 +<dict>
120 + <key>execCommand</key>
121 + <string>/usr/local/bin/restartApache</string>
122 + <key>execUID</key>
123 + <integer>0</integer>
124 + <key>keys</key>
125 + <array>
126 + <string>State:/Network/Global/DNS</string>
127 + <string>State:/Network/Global/IPv4</string>
128 + <string>State:/Network/Global/IPv6</string>
129 + <string>State:/Network/Global/NetInfo</string>
130 + </array>
131 + <key>name</key>
132 + <string>restart_apache</string>
133 + </dict>
134 +
135 +{{/code}}
136 +
137 +== Restart ==
138 +
139 +Restart your machine (you may be able to get away with just logging out and back in). Any network changes will now automatically restart Apache.
140 +
141 +== Extra Credit ==
142 +
143 +I also like to have a growl notification fire when my Apache restarts. To do this:
144 +
145 +1. grab the growl shell script from [[http://www.macosxhints.com/dlfiles/growl_sh.txt]].
146 +1. next, at the end of your /usr/local/bin/restartApache script, you can add:
147 +
148 +{{code}}
149 +
150 +export G_APPLICATION_ICON=EOModeler.app
151 +export G_TITLE=WebObjects
152 +/usr/local/bin/growl "Apache Restarted"
153 +
154 +{{/code}}