| Author |  | 
| Nux 
 
  
 Joined: 08 Jun 2016
 Posts: 1
 Location: Poland, 3city
 
 | 
|  Posted: Fri 10 Jun '16 13:15    Post subject: [REQUEST] Change httpd.conf in builds to `Define` srvroot |   |  
| 
 |  
| Hi. 
 So with current distributions of Apache on ApacheLounge in reality you need to put them in "C:\Apache24" or you would have to change a lot in `httpd.conf`. It's not a lot of work change default `httpd.conf` but it's tricky for some new comers (I work at IT company and I just know
  ). 
 So... The solution for any Apache 2.4 build would be to use new `Define` directive. That way you can define something like `SRVROOT` and use this in httpd.conf in any other place
 
 Crucial parts of modified httpd.conf would look like this:
 
  	  | Code: |  	  | Define SRVROOT "C:/Apache24"
 ServerRoot "${SRVROOT}"
 ...
 DocumentRoot "${SRVROOT}/htdocs"
 <Directory "${SRVROOT}/htdocs">
 ...
 ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
 ...
 <Directory "${SRVROOT}/cgi-bin">
 
 | 
 
 But I Would simply replace all occurrences of "C:/Apache24" with "${SRVROOT}" (including comments).
 
 Note that this `Define` works in all possible directives (even non standard ones like e.g. `ISAPICacheFile`).
 |  | 
| Back to top |  | 
| Steffen Moderator
 
 
 Joined: 15 Oct 2005
 Posts: 3130
 Location: Hilversum, NL, EU
 
 | 
|  Posted: Fri 10 Jun '16 15:04    Post subject: |   |  
| 
 |  
| Agree. But policy is that we do not change things what ASF delivers. |  | 
| Back to top |  | 
| Steffen Moderator
 
 
 Joined: 15 Oct 2005
 Posts: 3130
 Location: Hilversum, NL, EU
 
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Wed 13 Jun '18 11:44    Post subject: |   |  
| 
 |  
| You did not commit it in trunk |  | 
| Back to top |  | 
| Steffen Moderator
 
 
 Joined: 15 Oct 2005
 Posts: 3130
 Location: Hilversum, NL, EU
 
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Wed 13 Jun '18 16:02    Post subject: |   |  
| 
 |  
| Maybe I was in viewwc in the wrong revision.  |  | 
| Back to top |  | 
| Tim_B 
 
 
 Joined: 23 Sep 2021
 Posts: 1
 Location: Australia, Melbourne
 
 | 
|  Posted: Fri 24 Sep '21 13:39    Post subject: DocumentRoot |   |  
| 
 |  
| Hi Nux and Steffen, 
 I've run into a an issue with the "Define SRVROOT" Directive.
 
 I'm trying to set up Apache 2.4 on Windows 10 as my local development environment after a fresh re-install of Windows and cannot figure out how to change the DocumentRoot Directory from "${SRVROOT}/htdocs" to "C:/localhost" in the httpd.conf file.
 
 It seems that removing the SRVROOT variable and using an absolute file path: DocumentRoot "C:/localhost" as in previous versions prevents Apache from starting.
 
 I tried creating an Alias to link to it that way:
 
 Alias "/localhost" "C:/localhost"
 <Directory "c:/localhost">
 Require all granted
 </Directory>
 
 Which does append the "localhost" directory to the DocumentRoot directory (C:/Apache24/htdocs), but that's not really setting the DocumentRoot to "C:/localhost" like I have in previous installations.
 
 I've spent most of my day reading through the documentation on apache.org and trying various methods to solve it, but everything I tried either prevents Apache from starting or doesn't set the DocumentRoot directory to where I want it.
 
 It was only by chance I came across this post discussing the change to using the 'Define' directive, so I'm hoping you can tell me if there's a way to revert to the older style 'httpd.conf' directives for defining ServerRoot and DocumentRoot?
 
 Regards,
 
 Tim
 |  | 
| Back to top |  |