Changes for page Development Tools-Running Through Apache
Last modified by Aaron Rosenzweig on 2011/05/09 01:46
From version 30.1
edited by Ray Kiddy
on 2011/01/13 17:04
on 2011/01/13 17:04
Change comment:
add question to restart script info
To version 42.1
edited by Kieran Kelleher
on 2007/10/18 08:27
on 2007/10/18 08:27
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.ki ddyr1 +XWiki.kieran - Content
-
... ... @@ -1,7 +1,5 @@ 1 -If you are accessing your application with URLs that look like [[http://localhost:45437/cgi-bin/WebObjects/AppName.woa/]] (with the xxx:portnum instead of xxxx/-portnum) ... then you are using the [[Evil Direct Connect>>Development-Direct Connect]]. See that [[page>>Development-Direct Connect]] for why you don't want to be using Direct Connect. See this page for how to stop. 1 +If you are accessing your application with URLs that look like [[http://localhost:45437/cgi-bin/WebObjects/AppName.woa/]] (with the xxx:portnum instead of xxxx/-portnum) ... then you are using the [[Evil Direct Connect>>Web Applications-Development-Direct Connect]]. See that [[page>>Web Applications-Development-Direct Connect]] for why you don't want to be using Direct Connect. See this page for how to stop. 2 2 3 -A summary of the following steps that applies specifically to MacOS X 10.5.5 can be found here: [[Running Through Apache - Leopard & Snow Leopard Client - Summary>>Running Through Apache - Leopard & Snow Leopard Client - Summary]] 4 - 5 5 = Turning on Apache = 6 6 7 7 Go to **System Preferences > Sharing > Services** and turn on **Personal Web Sharing** if it is not already on. ... ... @@ -8,7 +8,7 @@ 8 8 9 9 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. 10 10 11 -= OptionalExtraConfiguration: Explicitly Setting Your Hostname =9 += Restarting Apache Fix #1: Explicitly Setting Your Hostname = 12 12 13 13 {{info title="Useful Information"}} 14 14 ... ... @@ -26,7 +26,7 @@ 26 26 27 27 {{/warning}} 28 28 29 -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: 30 30 31 31 {{code}} 32 32 ... ... @@ -34,50 +34,10 @@ 34 34 35 35 {{/code}} 36 36 37 -That line may be commented out by default. You can simply uncomment it (remove the leading pound sign) .You willalsoneed to findthisblock35 +That line may be commented out by default. You can simply uncomment it (remove the leading pound sign) and then restart apache: 38 38 39 39 {{code}} 40 40 41 -# First, we configure the "default" to be a very restrictive set of 42 -# features. 43 -# 44 -<Directory /> 45 - Options FollowSymLinks 46 - AllowOverride None 47 - Order deny,allow 48 - Deny from all 49 -</Directory> 50 - 51 -{{/code}} 52 - 53 -And modify like so: 54 - 55 -{{code}} 56 - 57 -# First, we configure the "default" to be a very restrictive set of 58 -# features. 59 -# 60 -<Directory /> 61 - Options FollowSymLinks 62 - AllowOverride None 63 -# Order deny,allow 64 -# Deny from all 65 -</Directory> 66 - 67 -{{/code}} 68 - 69 -Got to the very end of **/etc/apache2/httpd.conf** and add : 70 - 71 -{{code}} 72 - 73 -Include /System/Library/WebObjects/Adaptors/Apache2.2/apache.conf 74 - 75 -{{/code}} 76 - 77 -Then restart apache: 78 - 79 -{{code}} 80 - 81 81 sudo apachectl restart 82 82 83 83 {{/code}} ... ... @@ -84,7 +84,7 @@ 84 84 85 85 == Tell the adaptor to use localhost == 86 86 87 -Edit **/System/Library/WebObjects/Adaptors/Apache 2.2/apache.conf** to make sure that your enabled/uncommented WebObjectsConfig property looks like this:45 +Edit **/System/Library/WebObjects/Adaptors/Apache/apache.conf** to make sure that your enabled/uncommented WebObjectsConfig property looks like this: 88 88 89 89 {{code}} 90 90 ... ... @@ -92,8 +92,6 @@ 92 92 93 93 {{/code}} 94 94 95 -(Note on Tiger, aka OS X 10.4.X, replace **Apache2.2** with **Apache** in the path above) 96 - 97 97 == Tell wotaskd to Use Localhost Too == 98 98 99 99 Edit **/System/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/Properties** ... ... @@ -108,8 +108,6 @@ 108 108 109 109 Now you need to restart wotaskd: 110 110 111 -===== OS X Tiger 10.4 ===== 112 - 113 113 {{code}} 114 114 115 115 sudo systemstarter stop "WebObjects Services" ... ... @@ -119,72 +119,82 @@ 119 119 120 120 or 121 121 122 - =====OSX10.5 Leopard(wherelaunchdisusedtocontrolwotaskd)=====76 +restart wotaskd and womonitor with launchctl if your WebObjects install launches that way. 123 123 78 +== Finally, Configure your Application == 79 + 80 +Add or edit these launch parameters: 81 + 124 124 {{code}} 125 125 126 -sudo launchctl stop com.apple.webobjects.wotaskd 84 +-WODirectConnectEnabled false 85 +-WOHost localhost 86 +-WOAdaptorURL http://localhost/cgi-bin/WebObjects 87 +-WOPort 5555 127 127 128 128 {{/code}} 129 129 130 - launchd shouldautomatically startwotaskd againfor you ifconfiguredproperly.91 +The WOPort is optional, but useful if you want consistent URLs for bookmarks and such. You can use any number you want, but it needs to be unique for each application you launch (or rather, you can only run one app instance on a given WOPort at a time). In WOLips, WOPort, WODirectConnectEnabled, and WOAdaptorURL already exist and just need to be updated. WOHost does not, and needs to be added. The dash in front of the name ("-WOHost") is important and must be in the name for the setting to work properly. 131 131 132 -You cancheckforwhetherwotaskdisrunning asa launchdjobby typing93 +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. 133 133 134 - {{code}}95 += Restarting Apache Fix #2: Kickstart = 135 135 136 - sudolaunchctllist|grep webobjects97 +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. 137 137 138 - {{/code}}99 +== Making a restart script == 139 139 140 - whichwillgive somethinglike this:101 +Create a script named /usr/local/bin/restartApache and set the contents to: 141 141 142 142 {{code}} 143 143 144 -43 - com.apple.webobjects.wotaskd 105 +#!/bin/bash 106 +/usr/sbin/apachectl stop 107 +sleep 1 108 +/usr/sbin/apachectl start 145 145 146 146 {{/code}} 147 147 148 - (In10.5 it appears tobe necessaryto launch with launchctl. See [[RunningMonitor and wotaskd on MacOS X 10.5 "client">>WO 5.4 Getting Started||anchor="javamonitor"]]112 +== Modifying Kicker == 149 149 150 -== Finally, Configure your Application == 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: 151 151 152 -Add or edit these launch parameters: 153 - 154 154 {{code}} 155 155 156 --WODirectConnectEnabled false 157 --WOHost localhost 158 --WOAdaptorURL http://localhost/cgi-bin/WebObjects 159 --WOPort 5555 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> 160 160 161 161 {{/code}} 162 162 163 - TheWOPort is optional, but useful if you want consistent URLs for bookmarks and such. You can useany number you want, but it needso be unique for each application you launch (orrather,you can only run one app instance on a given WOPort at a time). In WOLips, WOPort, WODirectConnectEnabled, and WOAdaptorURL already exist and just need to be updated. WOHost does not, and needs to be added. The dash in front of the name ("-WOHost") is important and must be in the name for the setting to work properly.137 +== Restart == 164 164 165 - You may want to sethisinyourglobal WOLips settingssoyoudon't haveto setiteverytime youmake anewlaunchconfiguration.Youwillneedto gobackandmodify existinglaunchconfigurations withthese settings even if yousetit globally. Global settings onlyapply to newlycreatedlaunchconfigurations.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. 166 166 167 -= ApacheRestart=141 +== Extra Credit == 168 168 169 - {{infotitle="WhywouldIneed this?"}}143 +I also like to have a growl notification fire when my Apache restarts. To do this: 170 170 171 - Ifyou have a laptop and yougetan "Application cannotbefound" or some such error inthebrowserafter auto-switching networks(forexample going froma work network to ahome network), restarting apache can resolve the error conditionmostthe time. Ascript is shown below to do that.172 - Ifyou already implementedthe"localhost"explicitostnamesetupabove,thenyouwill probablynot needto botherwiththissection.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: 173 173 174 -No, really. Why would one need this? Is there a difference between ("apachectl stop" ; "apachectl start") and "apachectl restart"? If so, that may be a problem with apachectl. If there is a difference, why is the difference important? What bad thing will happen if one only uses "apachectl restart"? 175 - 176 - 177 -{{/info}} 178 - 179 -== Making a restart script == 180 - 181 -Create a script named /usr/local/bin/restartApache and set the contents to: 182 - 183 183 {{code}} 184 184 185 -#!/bin/bash 186 -/usr/sbin/apachectl stop 187 -sleep 1 188 -/usr/sbin/apachectl start 150 +export G_APPLICATION_ICON=EOModeler.app 151 +export G_TITLE=WebObjects 152 +/usr/local/bin/growl "Apache Restarted" 189 189 190 190 {{/code}}