Edit: I
think part of the problem is I needed to use port 8080, but I'm still getting the
"unable to connect" message. Is there anything I need to configure in /etc to make that
accessible?
--
It seems likely that this is an obvious
question, but I'm having trouble tracking down any useful information. Normally when
accessing files in a particular directory on a server, I'm able to create a virtual
host, assign a domain, root directory location, etc -- however am in a situation where I
have server space and need to access files with only a hostname. Is this
possible?
For example, let's say the
hostname is 123hostname.com, and the file I want access to is in
/home/sub-directory/filename.php. How do I get at it via a
browser?
I've tried:
href="http://123hostname.com/home/sub-directory/filename.php" rel="nofollow
noreferrer">http://123hostname.com/home/sub-directory/filename.php
...and some other variations on that theme
(that I can't post because new users are restricted to one link in messages). But
generally stuck. Any help -- even if it's just to let me know that this isn't possible
without some additional configuration -- would be great. Thank you!
Answer
Usually web servers are configured to only
allow access to user files in a specific directory, traditionally the public_html
directory. The url format would be rel="nofollow noreferrer">http://example.com/~user/dir/file.html which
would translate to
/home/user/public_html/dir/file.html
This is for
security reasons. Imagine if anyone could access your .ssh_keys directory from the web,
anyone could break into that
account.
For that reason, there isn't
any way that you do what you want directly.
On
the other hand, there is nothing wrong with accessing a server by hostname. A virtual
host is just another name for that same server, which usually has different content
served out. There is nothing you can do with a virtual host which you can't also do with
the correct hostname.
Comments
Post a Comment