0

I have a windows server 2012 and it has a valid IP address in internet. I installed VMWare on windows server and create a Linux CentOS virtual machine in VMWare.
In the Linux i run Apache server and I can see Apache page when I enter localhost in Linux browser, but in the windows when I use the Linux IP address i can't see the Apache server page! my virtual network adapter in on NAT and the Linux IP is 192.168.79.20, I can ping this IP from windows but I can't access Apache server. so I opened the port number 80 in linux (iptable) and used port forwarding to forward all incoming data on 8888 in windows to Linux IP address and port number 80. it doesn't work until I stoped Linux firewall. when i stop the Linux firewall I can access to Apache server from host (windows server) by using http://localhost:8888! but when i use Linux IP and port like 192.168.79:80 i can't see the Apache server page!
I have three problem:
1. I want to have Apache server and Firewall together not one of them.
2. I want to access Linux Apache server by using IP and port
3. I want set a domain for linux. so add a record in windows DNS server and forward it to Apache server. for example when somebody use MyDomain.com he/she can see Apache server page!
can you help me? what is wrong in my configuration? and is there any points that I forgot to do?!
thank you.

2 Answers 2

3

You probably used iptables -A you should have used iptables -I. As a default, CentOS has drop rule at the end of the INPUT chain, -A puts a rule at the end of a chain after the drop so kit never gets evalated. You should go read some documentation on the tools you're attempting to use, it's not as easy as it looks.

2
  • thank you for your answer, but I'm programmer and I'm not a server manager, so can you show me some documents or references?
    – user228876
    Jul 2, 2014 at 6:21
  • 1
    man iptables is where you should start.
    – Jenny D
    Jul 4, 2014 at 13:42
0
  1. Create a backup of file /etc/sysconfig/iptables (in case you screw it up)
  2. Edit file /etc/sysconfig/iptables
  3. Copy the line for SSH (port 22) and paste below this line. Add the port 80 or any other port you want to the new line.
  4. Save the file

Note: BE VERY CAREFUL EDITING THIS FILE!!!

1
  • 1
    It's much easier to use iptables commands to get the firewall how you want it then just use service iptables save to create the file.
    – user9517
    Jul 2, 2014 at 7:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .