rejetto forum

Custom IP Address For One Folder

Guest · 16 · 8456

0 Members and 1 Guest are viewing this topic.

Justin Clayton

  • Guest
So I was trying to find a way to get one folder to have a different Port Number so if I purchase 3 different domains I can have them route to the same HFS.exe program but each of them could be different depending on the URL. Would this be possible. I have typed and example so if I am not making myself clear enough.

Three websites: Site1, Site2 and Site3
Three folders in HFS.exe: Folder1, Folder2 and Folder3

I want to link Site1 to Folder1 on the Port "80"
I want to link Site2 to Folder2 on the Port "8080"
I want to link Site3 to Folder3 on the Port "1337"

Is this passable to do without launching more than one HFS.exe program?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
no, sorry.

i guess you may do it by using apache as reverse proxy, but i never did it.


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
You can setup a multi-site template in the following way (only with beta versions and macros and if you only allow access to registred users). This system allows to host different domains(sites) on the same ip with the same port, when accessed with different url-domains.

1. put in special:begin some macros in the following way:

Code: [Select]
{.set|site|standard.}
{.if |{.is substring|localhost|{.header|host.}.}|{:{.set|site|local.}:}.}
{.if |{.is substring|192.168.|{.header|host.}.}|{:{.set|site|local.}:}.}
{.if|=|{.^site.}|local|{:{.set|site|{.urlvar|site.}.}:}.}  {.comment| you must privide ?site=domain if lan-access.}
{.if |{.is substring|81.172.14.101|{.header|host.}.}|{:{.set|site|standard.}:}.}
{.if |{.is substring|domain1|{.header|host.}.}|{:{.set|site|site1.}:}.}
{.if |{.is substring|domain2.no-ip|{.header|host.}.}|{:{.set|site|site2.}:}.}
{.if |{.is substring|domain3|{.header|host.}.}|{:{.set|site|site3.}:}.}

2. all users must belong at least to the group associated with each domain

3. your folders for each site must only allow access to members of the associated group

4. In the root template, use {.switch.} in the header (to load different stylesheets), main, upload and error section to present a different 'homepage' for each site, where users are encouraged to login to access your files. Once they are logged in, show a link (a box, a button, an image...} to access your server and link to the folder. Example for the main section (only the most important thing - no design):

Code: [Select]
{.switch|{.^site.}|,|
        standard | {: This is not a public server :}
site1 |{:
{.if |%user%|{:<a href="/folder1"> {.^drawbutton|Acceso to fileserver.} </a>:}|{:You must login with a valid account to access this site:}.}
                 :}
site2 |{:
{.if |%user%|{:<a href="/folder2"> <{.^drawbutton|Acceso to fileserver.} </a>:}|{:You must login with a valid account to access this site:}.}
                 :}
          ...
       .}

5. In each folder, you can use a diff-template to show your pages according to the site (different style, design, color etc. )
your computer has no brain - use your own !


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
@bacter
thank you for sharing, but he asked for multiple ports. hfs doesn't do it. (not yet)


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
I understood that he asked to use different ports for running three sites in one instance of hfs. ┬┐But why would he need 3 domains if he could use three ports?

But as this is by now not possible, i suggested this solution to run three different sites on the same port. If HFS would support different ports in one instance, he would not need to have three different domains, different ports would be enough! So having the 3 domains, with this workaround he can have 3 sites on the same port in one instance. :)

your computer has no brain - use your own !


Justin Clayton

  • Guest
I sincerely apologize for not making myself clear. Let me enplane what I am doing and it might help. I have Comcast who just loves to block port 80 hosting traffic. So with HFS I can set a password for the entire folder or just some folders. I have a lot of domains like BlaBlaBla.com that I can direct to a URL with different ports. But I need HFS to be able to have different folders that can host with different ports. I use an intranet currently on port 80, but I'd like to be able to host two other sites off HFS. So I am looking for an intranet, blablabla.com and blablabla2.com.

Intranet - Port 80 - Folder1
BlaBlaBla.com - Port 1337 - Folder2
BlaBlaBla2.com - Port 8080 - Folder3

All from on HFS.exe

So I am looking to get the option for a folder to be hosted on a different port. I can already link the domains to an ip with a specialized port, just need the ability to get different folders to host on different ports.

Hope this helps trying to explane what I need.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
are you sure you need to have different ports?
you already have different domains.
if they points to your computer IP, then you can still tell which domain was used (and thus use this information to make a difference).

this is true if your domains point to your IP, not if you are using an http redirection (also called webhop).


Justin Clayton

  • Guest
Yes, it does need to be different ports because I would like to host three different websites from one instance of HFS.

So within one folder will contain one site, another folder another site and a 3rd folder for a 3rd site.

So I would like to do is:

DomainNumberOne on port 80 to HFS/DomainNumberOne
DomainNumberTwo on port 8080 to HFS/DomainNumberTwo
DomainNumberThree on port 1337 to HFS/DomainNumberThree

I can link my domains to redirect to an IP and a designated port but I need HFS to be able to asign folders with disagnated ports.

So for example:

HFS/DomanNumberOne needs to be hosted from Port 80
HFS/DomanNumberTwo needs to be hosted from Port 8080
HFS/DomanNumberThree needs to be hosted from Port 1337

I can not just have all three domains to link to one port on HFS because they will all go to the same site. I need each domain to go to a certain directory in HFS based on IP. Is there any other way to do this or do I have to wait for a beta release if this option gets selected?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
Yes, it does need to be different ports because I would like to host three different websites from one instance of HFS.

normally a SINGLE webserver can host different websites based on different domains by using a SINGLE port.
so, if you can't tell us exactly the reason, it's hard to believe that you really need more ports.

Quote
I can link my domains to redirect to an IP and a designated port but I need HFS to be able to asign folders with disagnated ports.

can't you redirect to an IP/folder instead of IP:port ?


JustinClayton0731

  • Guest
I am telling the reason. I don't have a web server. Your program would be the closest thing to a web server. Let me try and enplane this as easily as I can for you...

I have 3 Websites (Site1, Site2 and Site3)
I have 1 Spare Computer running Windows XP Home Ed.
I have a ISP who loves to block website hosting.

I would like to host my 3 websites from one instance of HFS. My domains are not on my spare computer. They are from GoDaddy.com. With GoDaddy.com I can redirect a domain to an IP and Port. (Ex: Site1 go to xxx.xxx.xxx.xxx:1337) and when I type Site1 into any computer in the world it would go to my spare computer that runs HFS. Not only would it go to HFS but a specialized folder that hosts the content for Site1.

I would like to do 3 instances of that which means I need different ports for each folder. If I link Site1 to xxx.xxx.xxx.xxx:1337/Site1 they might just delete the Site1 and go strait to xxx.xxx.xxx.xxx:1337 and be able to see all three sites. So I can solve this one of two ways. Request each folder to have the option of a different port, or have HFS run three instances on my computer or have three computers running three different sites. It would just be more efficient to have HFS have the ability to set a port to a folder.

I hope this helps enplane what I am looking for. I don't know how else to enplane it. I have noted everything I want and what my intentions are and how I plan to use HFS. I am currently doing this setup but with one site. I would like to be able to run all three of my sites from my spare computer to avoid paying sites to host what HFS could do.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
So, from your message i understand that your problem is not merely aesthetic, you don't want people discovering site2 starting from site1. Am i right?

1. if you just use ports, people can use a port scanner, and in few seconds they'll know your other ports.
it's plenty of free port scanners out there. the one i use it's only 0.07 MB.
this method works, but not very well.

2. if you use folders instead, you can remove the "browsable" option from the home/root.
your folders will continue working normally, and when someone will change the address to remove the /Folder1 it will just get an error. There's no known way to get to the other folders without knowing the names.
this method works flawlessly.


JustinClayton

  • Guest
I mean no offense when I say I am not dumb. I know there are port scanners and hundreds of them. That is not the concern.

Maybe you can tell me how to do this then. I feel I am not getting across what I am trying to do.

I HAVE a domain. I HAVE HFS. I HAVE a spare computer. I WANT to link the domain with the HFS to the spare computer. The PROBLEM is the domain will only let me link to one IP and one port. So, I CURRENTLY I can only link my domain's to xxx.xxx.xxx.xxx on port xxx. So since I only have one IP to my home If I link my next domain to xxx.xxx.xxx.xxx on port 80 I can't link the next domain to xxx.xxx.xxx.xxx on port 8080 because it will only look at the main home directory of HFS.

Hopefully this points out why I need ports on folders.

No matter where I link my domain's to I only have 1 IP coming into my home. So I can link them all to different ports but unless I am running three instances of HFS they will either not be recognized or they will have to be directed to the same port.

Does this help enplane what I am trying to do? I don't know how else to enplane it. I can draw a picture and post it as a .jpg if you want. I am trying to enplane the best I can. Sorry for the confusion.


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
I suppose it was clear WHAT YOU WANT and HOW YOU WANT IT from the beginning.

You want to host 3 'independent' sites, each with his domain-name, on one IP, using different ports to differentiate them.

If you understand that to differentiate the sites, there is no need to use a domainname AND a port for each site, there are two approaches to get WHAT you want.

1. You can differentiate your sites on template-level with macros, using the domain-name: Each request to HFS comes with a header, the 'host' element in this header looks normally like:
localhost:80   or  domain1.godaddy.com:80 
(or  only  localhost  or domain1.godaddy.com, as port 80 is default) or
127.0.0.1:1337   or your.domain2.inf:1337    or
192.168.1.3:8080 or  yourdomain3.com
or  (your external ip) 65.72.nn.mm(:port)

With the help of this header and macro you can  enforce access to the folders you want WITHOUT using different ports!

2. You could - theoretically - differentiate your sites on HFS program level, using the port number. But why then use different domain names? And actually HFS does not support this feature (quite useless, except for your special HOW I want it)

Each of the two methods have some drawbacks - even the method you want, as you will see.

- to be sure that users access to the site you want, you must ensure that they use your.domain1.com(:port) and not 65.72.nn.mm(:port), because as many domainnames point to the same IP, which any user can get, your site on port 80 is always exposed if somebody uses the ip and default port. The only way to avoid this, is to test the host-string in the request-header and then no port information is needed!

- if you would rely on ports, then every user who drops the port number from the url would finish on the site that is on port 80 !

- without using different ports, you have 3 local ways (localhost - 127.0.0.1 - 192-168.x.y) and 1 numeric external way and as many external ways as you have assigned domains to your IP. This is perfectily usable, so that the 3 local forms point to the same 'site' as the domainnames, and i recomend to use the external numeric way to point to a dummy page that does not reveal the existence of the other sites.

Take a look on the macro syntax in the wiki, then take another look at mi first post of this thread.  ;)

If you don't see then, that WHAT you want, can be done this way, and because it is not HOW you want it, then the only solution for you will be to start three instances of hfs (by the way: the best solution to migrate sites!  ;) ) - but with the same drawback of defaultport site if you do not check header-host in the templates!

By the way: I am hosting this way two sites (with two domains) and the generic site (if accessed with ip instead of url), each with his own folders and files, and even with different template-design.
your computer has no brain - use your own !


Justin Clayton

  • Guest
bacter, thank you. I will look into this when I have a little more time on my hands. I can't even program C++... HTML is as far as I can code. I'd be more than happy to Wiki everything.

And just for clarification. I am not trying to have a domain like you said. I already have domains setup that can link to different ports. I just need the ability to have HFS recognize what port I want and to witch folder it goes to.

As I said, I will research all the information you gave me and try and code this.

Thank you bacter and rejetto. If this works I don't think I could be happier with HFS!

(PS: Sorry for the spelling and gammer errors / On different computer)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
JC, i understand it can be frustrating wasting time with useless suggestions, but i bet it would not have happened if you directly answered this question:
can't you redirect to an IP/folder instead of IP:port ?

this successive sentence made me think it was possible:
If I link Site1 to xxx.xxx.xxx.xxx:1337/Site1 they might just delete the Site1 and go strait to xxx.xxx.xxx.xxx:1337 and be able to see all three sites.

But these comments of mine are not useful to solve your problem, so lets go on. :)
As i shortly said in my first post, HFS at this stage is not able to do what you want: it won't accept connections from more than one port. So,
if you don't want to have 3 HFSes open you will necessarily need the help of another entity that will redirect the 3 ports to a single one.
I suggested apache, that would give you some useful features in this task, but it is not really lightweight. :-\
A very lightweight solution would be to configure your router to map the 3 ports to the same single port.
Would this not be possible, another possibility is to use a "TCP tunnel", eventually named "port mapper".

These suggestions do not necessarily solve your whole problem, it's to make your HFS reachable by all ports you need.
« Last Edit: April 25, 2009, 12:27:16 PM by rejetto »