Re: post 8000

Rainer Joswig <[email protected]> Wed, 25 Feb 2009 12:19:37 +0100
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
Am 25.02.2009 um 00:56 schrieb Mark Klein:

>
> Rainer,
>
> Thanks for the suggestions.
>
>> For my solution (where the router redirects the traffic from 80 to
>> 8000), my CL-HTTP listens
>> on port 8000 and I use a virtual host like this:
>>
>> (http:add-virtual-host "foo.bar.com" 80 :http nil)
>>
>> This allows me to serve the domain foo.bar.com as if it were on  
>> port 80.
>> I then need to export URLs similar to this:
>>
>> (defun make-foo-url (url-string &key (host "foo.bar.com") (port 80))
>>  "Create an URL for this site."
>>  (url:intern-url (http:merge-url (list url-string :host host :port
>> port :protocol :http)
>>                                  (http:local-context))
>>                  :if-does-not-exist :create))
>
> That sounds simple enough. I just have to define a virtual host, and  
> then call make-foo-url for every URL defined in my code?

or set a default (local context) or use the extended #u syntax.

Example:

   #u("/foo.html" :host "foo.bar.com" :port 8003 :protocol :http)


>
> Don't I also need to do something to make sure that the virtual host  
> gets listed properly on DNS? Otherwise, how would the world know  
> that foo,bar.com = my server?

Sure, for every DNS name you need to make sure that it is listed in  
some valid DNS server.
In my case foo.bar.com  would point to the DNS number of the router.

I have following set up:


    Internet
       ^
       |
     Router  (foo.bar.com  166.100.10.20 port 80)
       |
       |
    Internal CL-HTTP machine   (virtual host foo.bar.com in CL-HTTP on  
port 8000, IP 10.0.1.14 )

So internally I have both a different IP address and a different port  
for the server.
The translation is done on the router. The router has to be configured  
for that.
The DNS also needs to know the IP address of the router.
My little network is behind address translation of the router.

This is similar how some larger sites might be configured.
Those have some layers of servers. In front are
load-balancers, the machines with Apache servers, then
application servers (running the logic) and then data
base servers. The frontend to the Internet are the load
balancers.

As mentioned before, this is one way to configure a CL-HTTP server.
The advantage is that only the web server port needs to be contactable
by the outside and the CL-HTTP application gets started and runs
as a normal user application (without special rights).

If one wants to use just one computer with lower performance  
requirements,
then one can also redirect the traffic on the same computer. Mac OS X
comes with the necessary tools for that (IIRC, it can be done with
the built-in firewall software). Especially in a Lisp case, when one
wants to touch the server later and develop/debug the live
site, I prefer to run CL-HTTP as a normal user application
(for example using the Apple remote control software to log in to
the Mac user interface and change a few things remotely).


Regards,

Rainer Joswig



>
> 	Mark
>
>
>>
>> Am 24.02.2009 um 22:07 schrieb Chun Tian (binghe):
>>
>>> Hi, Mark
>>>
>>> In theory, try to enable following one line in
>>> #p"http:examples;configuration.lisp" should work:
>>>
>>> (set-standard-http-port 80 :http)
>>>
>>> But the problem is that you may not have access to bind on port  
>>> 80, as
>>> a normal user on Mac OS X. Only port > 1024 is permitted. I suggest
>>> three ways:
>>>
>>> 1) Run an Apache which ships with MacOS and bind on port 80, then  
>>> use
>>> Apache proxy module and rewrite module to rewrite the Apache URL (on
>>> port 80) to CL-HTTP (on port 8000). (Most safe way I think)
>>>
>>> 2) Try to deliver your CL-HTTP applications into a standalone  
>>> console
>>> application, set CL-HTTP listen on port 80, then run it with "sudo".
>>>
>>> 3) Just save-image your lispworks with (:environment nil), as a
>>> console application, start LW from "sudo", then run a CL-HTTP in it.
>>> (not safe if your CL-HTTP also open the Web Listener)
>>>
>>> On 2009-2-25, at 03:15, Mark Klein wrote:
>>>
>>>>
>>>> I'm on Mac OS 10.5.6, running cl-http 70.216 on Lispworks 5.0.2  
>>>> on an
>>>> Intel duo-core.
>>>>
>>>> 	Mark
>>>>
>>>>> Mark,
>>>>> What OS are you serving from?
>>>>> -- 
>>>>> chr
>>>>>
>>>>> On Feb 24, 2009, at 7:51 PM, Mark Klein wrote:
>>>>>
>>>>>>
>>>>>> Is there a way to re-configure cl-http so it serves on the  
>>>>>> standard
>>>>>> port (i.e. so you don't have to specify the port in the domain
>>>>>> name)
>>>>>> rather than port 8000? If so, how? I have some users who's  
>>>>>> firewall
>>>>>> blocks port 8000, so they can't use my system.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> 	Mark
>>>>>>
>>>>>> -----------------
>>>>>> Mark Klein
>>>>>> Principal Research Scientist
>>>>>> MIT Center for Collective Intelligence
>>>>>> http://cci.mit.edu/klein/
>>>
>>> --
>>> Chun Tian (binghe)
>>> NetEase.com, Inc.
>>> P. R. China
>>>
>>>
>>> _______________________________________________
>>> WWW-CL mailing list
>>> [email protected]
>>> https://lists.csail.mit.edu/mailman/listinfo/www-cl
>>
>> Rainer Joswig, Hamburg, Germany
>> http://lispm.dyndns.org/
>> mailto:[email protected]
>>
>>
>>
>>
>> _______________________________________________
>> WWW-CL mailing list
>> [email protected]
>> https://lists.csail.mit.edu/mailman/listinfo/www-cl
>
> -----------------
> Mark Klein
> Principal Research Scientist
> MIT Center for Collective Intelligence
> http://cci.mit.edu/klein/
>
>
>

Rainer Joswig, Hamburg, Germany
http://lispm.dyndns.org/
mailto:[email protected]




_______________________________________________
WWW-CL mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/www-cl