i wanted to change a working apache configuration of example.com (exampleIP = 1.2.3.4 ) to change from the default port 80 to port 8001, such that http://example.com:8001 should work. I wasn't able to do so, and will document what i have attempted. I think I might need help on iptables.

my /etc/hosts firstly is fine

1.2.3.4 example.com

I started with replacing the port 80 with 8001 in the following places

/etc/apache2/ports.conf

Listen 1.2.3.4:8001

/etc/apache2/conf.d/virtual.conf

NameVirtualHost 1.2.3.4:8001

/etc/apache2/sites-enabled/example.com

<VirtualHost 1.2.3.4:8001>

ServerName example.com:8001
#UPDATE: ServerName example.com doesn't make a difference either

</VirtualHost>

When i replace 8001 in the above 3 cases with 80, it works. with 8001 i can't establish a connection. tcpdump also doesnt show incoming requests.

Since apache daemon when restarted did not throw any errors, i tried confirmation if the webserver was listening on 8001

...This might be because the interface
on which you're capturing is plugged
into a switch; on a switched network,
unicast traffic between two ports will
not necessarily appear on other ports
- only broadcast and multicast traffic will be sent to all ports...

...which would indicate that if you
sniff on a 10Mb port, you will not see
traffic coming sent to a 100Mb port,
and vice versa...

...If your machine is not plugged into
a switched network or a dual-speed
hub, or it is plugged into a switched
network but the port is set up to have
all traffic replicated to it, the
problem might be that the network
interface on which you're capturing
doesn't support "promiscuous" mode, or
because your OS can't put the
interface into promiscuous mode...

Are you attempting to connect from the localhost, another machine on the local net, or a machine on a remote network?
– Catherine MacInnesJan 21 '10 at 22:33

am trying to call from two local machines from two different geographies ( ie 1.2.3.4:8001 or example.com:8001 ) Both via curl and browser, it doesnt connect. ping examples.com resolves to 1.2.3.4 as well.
– BoskyJan 21 '10 at 23:29

The rest you keep as you have already configured. Please note that NameVirtualHost and VirtualHost must have the same signature. And because it is a name based virtual host you need to add into your hosts file on the machine with the browser a line like:

unforunately this did not make a difference. i dont have tshark on the machine, but tcpdump that effectively does the same thing did not detect anything. NOTE: i do have some added information in UPDATE 2 about some promiscuous mode
– BoskyJan 22 '10 at 9:25

tcpdump by default change the network card to be in promiscous mode. you can disable with: tcpdump -p ..... if you do not see traffic you have a networking problem. Try to solve that before doing any apache changes.
– Mircea VutcoviciJan 22 '10 at 16:38