-3

I have a problem in publish Multi web Site in multi web server with a single Public IP and all of these Web Sites use Same default port of 80 but have different URL address .

I want publish all of these web sites in internet with default Http port 80 and without change default port http in Internal web servers in a Cisco Router .

may help me to publish these web sites .

Schema of my network for this issue :

Network Schema


i suggest following cisco commands for resolve this problem:

please tell me your opinion :


class-map match-all cweb1

       match protocol http url "www.test-A.com"

policy-map pweb1

      class cweb1

route-map rweb1 permit 10

      match policy-list pweb1

ip nat inside source static 192.168.0.10 280.200.150.10 route-map rweb1


but my problem in these commands is that i can't publish more than 1 Web Site with these command .

if use these command for more than 1 web site cisco router give me a "ERROR" .

have you any solution for resolve these cisco command ?

  • If you're certain that you need to configure this using the Cisco router, then at least provide the model number and version of IOS you are using. Without these, it's really difficult to give you good advice or instruction on what to do. The solution I posted below is more flexible, manageable and would be the recommended solution. – jaseeey Jan 30 '14 at 23:49
6

You can't map a port on a public IP address to more than one private IP address, it just won't work because how is the router supposed to know which one to go to?

If you're using name-based virtual hosts, you could achieve this by sitting a HAProxy instance in-front of the web instances and direct all traffic from the router to the HAProxy instance. On the HAProxy instance, you create a front-end and specify the domains and the backend to use. Then, depending on which domain is accessed via HTTP, it forwards the request to the appropriate back-end to serve the request.

I do it all the time when I want to conserve server or IP resources.

                                            /-----> Web Instance 1
Web ------> Router ------> HAProxy Instance ------> Web Instance 2
                                            \-----> Web Instance 3

Below is a sample configuration for the HAProxy frontend and backends which I just wrote up. This is not the full configuration file, so please use the /etc/haproxy/haproxy.cfg as a guide to having a complete configuration.

frontend MAIN
    bind *:80
    mode http

    acl EXAMPLE1_URL hdr_dom(host) -i www.example1.com
    acl EXAMPLE2_URL hdr_dom(host) -i www.example2.com
    acl EXAMPLE3_URL hdr_dom(host) -i www.example3.com

    use_backend EXAMPLE1 if EXAMPLE1_URL
    use_backend EXAMPLE2 if EXAMPLE2_URL
    use_backend EXAMPLE3 if EXAMPLE3_URL

 backend EXAMPLE1
     mode http
     server web1 192.168.1.1:80

 backend EXAMPLE2
     mode http
     server web2 192.168.1.2:80

 backend EXAMPLE3
     mode http
     server web3 192.168.1.3:80

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.