Jump to content

Using Aliases for Other Directories


Recommended Posts

Good Morning,

I have my live Apache server setup to be accessible internally over the network but I only really have one directory setup to be accessible which is accessed via the computer name (at least I think?)...so http://computerName takes you to the folder I have it pointed at.

I would like to be able to setup other directories for other uses (for example AWStats) which would only be accessible to me but I've tried using Aliases and gotten nowhere...I always mess something up in the config file and have to revert back to how I had it. Also, I've tried setting up Aliases using the menu provided in WAMP and I still get nowhere. I think this is the only <Directory> config I have in it right now.

<Directory />
    AllowOverride none
    Require all granted
</Directory>

What do I need to do to be more specific about directories and allowing access to them? 

One other question, I log the IP of the users when they login, and when users are using VPN obviously their network IP is different. The VPN software has two IPs, it's main one and the one it issues to it's clients. I when I grab it using $_SERVER['SERVER_ADDR'] in PHP I always get the main VPN IP...is there a way of getting the one the VPN issues to the client? I only ask so I can tell Apache my internal IP when on the network and my IP using the VPN so I had access AWStats remotely as well...other than having to RDP into the server...

Link to post
Share on other sites

To alias a directory you'd generally need something like this at least.

Alias /want "C:/The/Directory/You/Want"
<Directory "C:/The/Directory/You/Want">
    Require all granted
</Directory>

Depending on what exactly you want you might need some more configuration options inside the <Directory> block, like Options +ExecCGI if you need to run PHP scripts using fast-cgi.

2 hours ago, mongoose00318 said:

I when I grab it using $_SERVER['SERVER_ADDR']

$_SERVER['SERVER_ADDR"] represents apache's local address.  If you want the address of the client connecting to the server you need $_SERVER['REMOTE_ADDR'].  With regard to VPN's, that remote address will be the VPN exit server's public IP.  There's no way to get the clients local pre-vpn IP (which is part of the reason people use VPNs these days).

Link to post
Share on other sites

@kicken 

1 hour ago, kicken said:

$_SERVER['SERVER_ADDR"] represents apache's local address.  If you want the address of the client connecting to the server you need $_SERVER['REMOTE_ADDR'].  With regard to VPN's, that remote address will be the VPN exit server's public IP.  There's no way to get the clients local pre-vpn IP (which is part of the reason people use VPNs these days).

Ah yes that would make sense...and yes I meant to say REMOTE_ADDR...sorry about that.

So if I make an Alias of /want and the root of path to the server is http://computerName; then I would access /want via http://computerName/want?

Link to post
Share on other sites

Okay cool...I have an Alias working...I think I was doing something with virtual hosts...maybe I got confused about what was what...

Now, I need to get some kind of Apache log analyzer for usage statistics. I really want to use GoAccess but I can't seem to get it working (having to use Cygwin on a WAMP setup)...it looks much better than something like AWStats...

Any suggestions when it comes to a log analyzer like this?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.