logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: [REQUEST] Change httpd.conf in builds to `Define` srvroot
Author
Nux



Joined: 08 Jun 2016
Posts: 1
Location: Poland, 3city

PostPosted: Fri 10 Jun '16 13:15    Post subject: [REQUEST] Change httpd.conf in builds to `Define` srvroot Reply with quote

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 Wink).

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: 3093
Location: Hilversum, NL, EU

PostPosted: Fri 10 Jun '16 15:04    Post subject: Reply with quote

Agree. But policy is that we do not change things what ASF delivers.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3093
Location: Hilversum, NL, EU

PostPosted: Fri 08 Jun '18 11:49    Post subject: Reply with quote

Committed for the next release, see http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1832962
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 13 Jun '18 11:44    Post subject: Reply with quote

You did not commit it in trunk
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3093
Location: Hilversum, NL, EU

PostPosted: Wed 13 Jun '18 11:50    Post subject: Reply with quote

It was already there: http://svn.apache.org/viewvc?view=revision&sortby=date&revision=1451830

I did:

In my branches working copy

svn merge -c 1451830 https://svn.apache.org/repos/asf/httpd/httpd/trunk

svn ci
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 13 Jun '18 16:02    Post subject: Reply with quote

Maybe I was in viewwc in the wrong revision. Embarassed
Back to top
Tim_B



Joined: 23 Sep 2021
Posts: 1
Location: Australia, Melbourne

PostPosted: Fri 24 Sep '21 13:39    Post subject: DocumentRoot Reply with quote

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


Reply to topic   Topic: [REQUEST] Change httpd.conf in builds to `Define` srvroot View previous topic :: View next topic
Post new topic   Forum Index -> Apache