Apache Alias Configuration
I am new to the whole server configuration thing, and am reaching the conclusion that either the people who've designed Apache and Linux are certifiable, or I am a complete idiot. On balance of probability, I'm leaning towards the latter.
I have a new server running Debian.
I have php on that server.
I have some scripts on that server that I want ALL of the sites on the server to be able to access. These scripts are in /usr/share/myapp , which is outside the accessible path. Note that other apps, like phpmyadmin, are also located in the /usr/share folder.
I want visitors to go the the websites on my server and be able to run the scripts as though they are in the root of the domain (not the file path root).
So... a url www.domain.tld/myapp/myfile.php will transparently run /usr/share/myapp as though /myapp was in the domain root, and a file call to document_root/myapp/myfile.php would open the file in /usr/share/myapp as though it was in the specified location.
For compatability, I need to reference the desired files using
$_SERVER['DOCUMENT_ROOT'] for file path references like include($_SERVER['DOCUMENT_ROOT']."/myapp/file.inc.php"
or $_SERVER['HTML_HOST'] for url path references like action="<?=$_SERVER['HTML_HOST']?>/myapp/file.php".
After much wailing and gnashing of teeth, we're thinking that the best way to achieve this is with an Alias set up within Apache2.
For guidance, we turned to the way phpmyadmin was configured, and created the following myapp.conf file within the /etc/apache2/conf.d folder.
But it doesn't work.
Alias /myapp /usr/share/myapp
It has been suggested that what we might have is an ownership issue, in that the files are owned by user 'root', and may need to be owned by nobody. I'm not convinced. phpmyadmin's files are also owned by root, and it works just fine.
It has also been suggested that the Alias makes /usr/share/myapp the html root, and if we want to have htmlroot/myapp, then /usr/share/myapp needs to then have a folder within called myapp. This to maintain the path integrity.
These are just speculation though, and I'm thinking we could do some damage playing around with stuff we don't properly understand, so I thought I'd come here and see if I can find people way more experienced than me who might be kind enough to offer gentle guidance.
Are we on the right track?
What are we doing wrong?
What more do we need to do?
Is there a better way to do this without exposing the php scripts to a domain space owner?
So what does happen? A 404 error? A forbidden error?
to that <Directory> block.
Allow from all
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)