Project

General

Profile

How to give the local IP a URL?

Added by Sebastian Fett over 2 years ago

Can I specify that inside WT that the mydomain.com will listen to the internal IP and PORT my webserver is running on or do I need to do that outside of WT?

It is said that WT can resolve hostnames but I cannot find where I am supposed to specify said hostname.

Thanks in advance

Sebatian


Replies (5)

RE: How to give the local IP a URL? - Added by Roel Standaert over 2 years ago

wthttp will resolve the hostname using the host's resolver, so if on that host the hostname resolves to 127.0.0.1 (e.g nslookup mydomain.com resolves to 127.0.0.1), Wt will use that.

RE: How to give the local IP a URL? - Added by Roel Standaert over 2 years ago

I'm not entirely sure why you would need to do that, though. If you're simply listening on an internal IP, then just use the IP address?

RE: How to give the local IP a URL? - Added by Sebastian Fett over 2 years ago

I dont really need to use a hostname but it simply looks better. So i would need to edit the /etc/hosts to regard the ---http-listen address and port i specify on launch as the string i want to represent my hostname?

RE: How to give the local IP a URL? - Added by Roel Standaert over 2 years ago

Yes, wthttp simply uses whatever your system normally uses to resolve hostnames.

RE: How to give the local IP a URL? - Added by Paweł Grodowski over 2 years ago

I assume the executable environment is Linux. If I understand correctly, the external domain should be directed to the local (intranet, inernal network) address, (for example) 127.0.0.1:80 or for the protocol https: 127.0.0.1:443.

for httpd (apache2 web server), for local network, You need use Yours configuration (for internet domain virtual host).

Yes You need do that outside of Wt library. (I suppose)

my configuration for a virtual host looks like this:

<IfModule fcgid_module>

 <VirtualHost 192.168.3.2:443>

  ServerName wt.onion.lan
  DocumentRoot "/home/vacterm/projects/workdirs"

  <IfModule dir_module>
    DirectoryIndex index.html index.php index.wt
  </IfModule>

  Alias ​​/HelpTxt "/home/vacterm/projects/workdirs/helptext"

   <Directory "/home/vacterm/projects/workdirs">

    Options Indexes FollowSymLinks

    #AllowOverride None
    AllowOverride All

    Require all granted
   </Directory>

   <Directory /home/vacterm/projects/workdirs/helptext>
     AllowOverride None
     Options -MultiViews +SymLinksIfOwnerMatch
     Order allow, deny
     Allow from all
     Require all granted

   </Directory>

   # HOWTO
   # http://www.apachetutor.org/admin/reverseproxies

   ProxyPass /helptext/ http://wt.onion.lan:80/

   FcgidCmdOptions /home/vacterm/projects/workdirs/helptext/index.wt \
    InitialEnv \
        WT_APP_ROOT=/home/vacterm/projects/workdirs/helptext

   CustomLog "/var/log/httpd/access_wt_log" common

 </VirtualHost>

</IfModule>

I am not completely convinced, but the line:

ProxyPass /helptext/ http://wt.onion.lan:80/

is the solution:

Use Reverse Proxy meachanism.

# HOWTO

# http://www.apachetutor.org/admin/reverseproxies

Your Internet URL will become (for example) http://127.0.0.1:80/

under 127.0.0.1 you start,

Normal Wt Web Application (Wt Web Sever httpd), in Yours intranet:

sudo ./index.wt

---docroot=".;/resources/wt_config.xml, /css"

*---http-address='127.0.0.1'

---port='80'*

    (1-5/5)