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

From version 55.1
edited by Kieran Kelleher
on 2007/10/18 08:04
Change comment: There is no comment for this version
To version 58.1
edited by ghulands
on 2008/08/18 23:37
Change comment: Added in to modify the httpd.conf's <Directoy/> settings

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.kieran
1 +XWiki.ghulands
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 -= Restarting Apache Fix #1: Explicitly Setting Your Hostname =
9 += Optional Extra Configuration: Explicitly Setting Your Hostname =
10 10  
11 11  {{info title="Useful Information"}}
12 12  
... ... @@ -14,15 +14,18 @@
14 14  
15 15  Bonjour Delays: Apparently the procedure here is also useful for preventing "Bonjour" delays when you launch the browser to test your app on your development machine.
16 16  
17 -
18 18  {{/info}}
19 19  
20 20  == Edit Apache Config ==
21 21  
22 -Note: **Do NOT try to use the Bonjour / Rendezvous name of your machine in this step.** It will cause you grief. Accept this and don't even try. You have been warned.
21 +{{warning title="Bonjour, comment ça va? .... Trés bien, merci!"}}
23 23  
24 -Edit **/etc/httpd/httpd.conf**, find the line containing **ServerName** and change it to this:
23 +*Do NOT try to use the Bonjour / Rendezvous name of your machine in this step.* It will cause you grief. Accept this and don't even try. You have been warned.
25 25  
25 +{{/warning}}
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**.
28 +
26 26  {{code}}
27 27  
28 28  ServerName localhost
... ... @@ -29,14 +29,56 @@
29 29  
30 30  {{/code}}
31 31  
32 -That line may be commented out by default. You can simply uncomment it (remove the leading pound sign) and then restart apache:
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
33 33  
34 34  {{code}}
35 35  
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 +Then restart apache:
68 +
69 +{{code}}
70 +
36 36  sudo apachectl restart
37 37  
38 38  {{/code}}
39 39  
75 +== Tell the adaptor to use localhost ==
76 +
77 +Edit **/System/Library/WebObjects/Adaptors/Apache/apache.conf** to make sure that your enabled/uncommented WebObjectsConfig property looks like this:
78 +
79 +{{code}}
80 +
81 +WebObjectsConfig http://localhost:1085 10
82 +
83 +{{/code}}
84 +
40 40  == Tell wotaskd to Use Localhost Too ==
41 41  
42 42  Edit **/System/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/Properties**
... ... @@ -79,10 +79,15 @@
79 79  
80 80  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.
81 81  
82 -= Restarting Apache Fix #2: Kickstart =
127 += Apache Restart =
83 83  
84 -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.
129 +{{info title="Why would I need this?"}}
85 85  
131 +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.
132 +If you already implemented the "localhost" explicit hostname setup above, then you will probably not need to bother with this section.
133 +
134 +{{/info}}
135 +
86 86  == Making a restart script ==
87 87  
88 88  Create a script named /usr/local/bin/restartApache and set the contents to:
... ... @@ -95,47 +95,3 @@
95 95  /usr/sbin/apachectl start
96 96  
97 97  {{/code}}
98 -
99 -== Modifying Kicker ==
100 -
101 -1. Edit /System/Library/SystemConfiguration/Kicker.bundle/Contents/Resources/Kicker.xml
102 -1. At the end of the <array> section, add the following block of XML:
103 -
104 -{{code}}
105 -
106 -<dict>
107 - <key>execCommand</key>
108 - <string>/usr/local/bin/restartApache</string>
109 - <key>execUID</key>
110 - <integer>0</integer>
111 - <key>keys</key>
112 - <array>
113 - <string>State:/Network/Global/DNS</string>
114 - <string>State:/Network/Global/IPv4</string>
115 - <string>State:/Network/Global/IPv6</string>
116 - <string>State:/Network/Global/NetInfo</string>
117 - </array>
118 - <key>name</key>
119 - <string>restart_apache</string>
120 - </dict>
121 -
122 -{{/code}}
123 -
124 -== Restart ==
125 -
126 -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.
127 -
128 -== Extra Credit ==
129 -
130 -I also like to have a growl notification fire when my Apache restarts. To do this:
131 -
132 -1. grab the growl shell script from [[http://www.macosxhints.com/dlfiles/growl_sh.txt]].
133 -1. next, at the end of your /usr/local/bin/restartApache script, you can add:
134 -
135 -{{code}}
136 -
137 -export G_APPLICATION_ICON=EOModeler.app
138 -export G_TITLE=WebObjects
139 -/usr/local/bin/growl "Apache Restarted"
140 -
141 -{{/code}}