I have two computers with IP addresses of 192.168.1.1 and 192.168.1.2 respectively. Both computers have Apache servers installed on them and both are listening to port 8080 rather than 80. I have connected both computers via LAN and I am successful in pinging each other. However, I am unable to access localhost of one computer on the other.
What are the required settings that should be altered??
The IP address 127.0.0.1 is a special loopback address commonly known as localhost. It aways refers to the machine you are currently on. It's best practice not to use the 127.0.0.0/8 netblock for addressing anything other than the local machine.
The LAN you describe to also has 192.186.1.1 and 192.186.1.2 bound to each machine respectively. Use this to communicate with each machine. e.g. from 192.186.1.1, enter http://192.186.1.2:8080/ to see the other machine.
When using names, like "localhost", your Hosts file is used to resolve the name to an IP address, falling back onto DNS. On most systems, this behaviour can also be modified.
The above assumes you have no firewalls or special routing in place.