I have a hard time understanding iptables rules.I am running a centos 6.5 VM on my laptop (vmware hypervisor) and it looks like it comes with this setup for iptables:# iptables -LChain INPUT (policy ACCEPT)target     prot opt source               destination         ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED ACCEPT     icmp --  anywhere             anywhere            ACCEPT     all  --  anywhere             anywhere            ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)target     prot opt source               destination         REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)target     prot opt source               destination         I just install apache on it, but I was not able to access the web server even though httpd is running.This is the error I get, if I attempt to access the web server from the localhost:[root@mig-dev-006 conf]# wget http://mig-dev-006.example.com--2014-07-09 08:46:00--  http://mig-dev-006.example.com/Resolving mig-dev-006.example.com... 192.168.203.129Connecting to mig-dev-006.example.com|192.168.203.129|:80... connected.HTTP request sent, awaiting response... 403 Forbidden2014-07-09 08:46:00 ERROR 403: Forbidden.From my Windows7 laptop (using cygwin) I get this error:$ wget http://mig-dev-006.example.com--08:45:47--  http://mig-dev-006.example.com/           => `index.html'Resolving mig-dev-006.cisco.com... 192.168.203.129Connecting to mig-dev-006.example.com|192.168.203.129|:80... failed: Connection timed out.I know that I can simply flush the iptables rules with iptables --flush, but I'd prefer to understand what is going on and be able to add a rule that would allow http and https traffic.  Here is my httpd.conf:$ grep -v # /etc/httpd/conf/httpd.conf  | grep -v ^$ServerTokens OSServerRoot /etc/httpdPidFile run/httpd.pidTimeout 60KeepAlive OffMaxKeepAliveRequests 100KeepAliveTimeout 15<IfModule prefork.c>StartServers       8MinSpareServers    5MaxSpareServers   20ServerLimit      256MaxClients       256MaxRequestsPerChild  4000</IfModule><IfModule worker.c>StartServers         4MaxClients         300MinSpareThreads     25MaxSpareThreads     75 ThreadsPerChild     25MaxRequestsPerChild  0</IfModule>Listen 80LoadModule auth_basic_module modules/mod_auth_basic.soLoadModule auth_digest_module modules/mod_auth_digest.soLoadModule authn_file_module modules/mod_authn_file.soLoadModule authn_alias_module modules/mod_authn_alias.soLoadModule authn_anon_module modules/mod_authn_anon.soLoadModule authn_dbm_module modules/mod_authn_dbm.soLoadModule authn_default_module modules/mod_authn_default.soLoadModule authz_host_module modules/mod_authz_host.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authz_groupfile_module modules/mod_authz_groupfile.soLoadModule authz_dbm_module modules/mod_authz_dbm.soLoadModule authz_default_module modules/mod_authz_default.soLoadModule ldap_module modules/mod_ldap.soLoadModule authnz_ldap_module modules/mod_authnz_ldap.soLoadModule include_module modules/mod_include.soLoadModule log_config_module modules/mod_log_config.soLoadModule logio_module modules/mod_logio.soLoadModule env_module modules/mod_env.soLoadModule ext_filter_module modules/mod_ext_filter.soLoadModule mime_magic_module modules/mod_mime_magic.soLoadModule expires_module modules/mod_expires.soLoadModule deflate_module modules/mod_deflate.soLoadModule headers_module modules/mod_headers.soLoadModule usertrack_module modules/mod_usertrack.soLoadModule setenvif_module modules/mod_setenvif.soLoadModule mime_module modules/mod_mime.soLoadModule dav_module modules/mod_dav.soLoadModule status_module modules/mod_status.soLoadModule autoindex_module modules/mod_autoindex.soLoadModule info_module modules/mod_info.soLoadModule dav_fs_module modules/mod_dav_fs.soLoadModule vhost_alias_module modules/mod_vhost_alias.soLoadModule negotiation_module modules/mod_negotiation.soLoadModule dir_module modules/mod_dir.soLoadModule actions_module modules/mod_actions.soLoadModule speling_module modules/mod_speling.soLoadModule userdir_module modules/mod_userdir.soLoadModule alias_module modules/mod_alias.soLoadModule substitute_module modules/mod_substitute.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule proxy_module modules/mod_proxy.soLoadModule proxy_balancer_module modules/mod_proxy_balancer.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.soLoadModule proxy_http_module modules/mod_proxy_http.soLoadModule proxy_ajp_module modules/mod_proxy_ajp.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule cache_module modules/mod_cache.soLoadModule suexec_module modules/mod_suexec.soLoadModule disk_cache_module modules/mod_disk_cache.soLoadModule cgi_module modules/mod_cgi.soLoadModule version_module modules/mod_version.soInclude conf.d/*.confUser apacheGroup apacheServerAdmin root@localhostServerName mig-dev-006.example.comUseCanonicalName OffDocumentRoot /var/www/html<Directory />    Options FollowSymLinks    AllowOverride None</Directory><Directory /var/www/html>    Options Indexes FollowSymLinks    AllowOverride None    Order allow,deny    Allow from all</Directory><IfModule mod_userdir.c>    UserDir disabled</IfModule>DirectoryIndex index.html index.html.varAccessFileName .htaccess<Files ~ ^\.ht>    Order allow,deny    Deny from all    Satisfy All</Files>TypesConfig /etc/mime.typesDefaultType text/plain<IfModule mod_mime_magic.c>    MIMEMagicFile conf/magic</IfModule>HostnameLookups OffErrorLog logs/error_logLogLevel warnLogFormat %h %l %u %t \%r\ %>s %b \%{Referer}i\ \%{User-Agent}i\ combinedLogFormat %h %l %u %t \%r\ %>s %b commonLogFormat %{Referer}i -> %U refererLogFormat %{User-agent}i agentCustomLog logs/access_log combinedServerSignature OnAlias /icons/ /var/www/icons/<Directory /var/www/icons>    Options Indexes MultiViews FollowSymLinks    AllowOverride None    Order allow,deny    Allow from all</Directory><IfModule mod_dav_fs.c>    DAVLockDB /var/lib/dav/lockdb</IfModule>ScriptAlias /cgi-bin/ /var/www/cgi-bin/<Directory /var/www/cgi-bin>    AllowOverride None    Options None    Order allow,deny    Allow from all</Directory>IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzipAddIconByType (TXT,/icons/text.gif) text/*AddIconByType (IMG,/icons/image2.gif) image/*AddIconByType (SND,/icons/sound2.gif) audio/*AddIconByType (VID,/icons/movie.gif) video/*AddIcon /icons/binary.gif .bin .exeAddIcon /icons/binhex.gif .hqxAddIcon /icons/tar.gif .tarAddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .ivAddIcon /icons/compressed.gif .Z .z .tgz .gz .zipAddIcon /icons/a.gif .ps .ai .epsAddIcon /icons/layout.gif .html .shtml .htm .pdfAddIcon /icons/text.gif .txtAddIcon /icons/c.gif .cAddIcon /icons/p.gif .pl .pyAddIcon /icons/f.gif .forAddIcon /icons/dvi.gif .dviAddIcon /icons/uuencoded.gif .uuAddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tclAddIcon /icons/tex.gif .texAddIcon /icons/bomb.gif coreAddIcon /icons/back.gif ..AddIcon /icons/hand.right.gif READMEAddIcon /icons/folder.gif ^^DIRECTORY^^AddIcon /icons/blank.gif ^^BLANKICON^^DefaultIcon /icons/unknown.gifReadmeName README.htmlHeaderName HEADER.htmlAddLanguage ca .caAddLanguage cs .cz .csAddLanguage da .dkAddLanguage de .deAddLanguage el .elAddLanguage en .enAddLanguage eo .eoAddLanguage es .esAddLanguage et .etAddLanguage fr .frAddLanguage he .heAddLanguage hr .hrAddLanguage it .itAddLanguage ja .jaAddLanguage ko .koAddLanguage ltz .ltzAddLanguage nl .nlAddLanguage nn .nnAddLanguage no .noAddLanguage pl .poAddLanguage pt .ptAddLanguage pt-BR .pt-brAddLanguage ru .ruAddLanguage sv .svAddLanguage zh-CN .zh-cnAddLanguage zh-TW .zh-twLanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TWForceLanguagePriority Prefer FallbackAddDefaultCharset UTF-8AddType application/x-compress .ZAddType application/x-gzip .gz .tgzAddType application/x-x509-ca-cert .crtAddType application/x-pkcs7-crl    .crlAddHandler type-map varAddType text/html .shtmlAddOutputFilter INCLUDES .shtmlAlias /error/ /var/www/error/<IfModule mod_negotiation.c><IfModule mod_include.c>    <Directory /var/www/error>        AllowOverride None        Options IncludesNoExec        AddOutputFilter Includes html        AddHandler type-map var        Order allow,deny        Allow from all        LanguagePriority en es de fr        ForceLanguagePriority Prefer Fallback    </Directory></IfModule></IfModule>BrowserMatch Mozilla/2 nokeepaliveBrowserMatch MSIE 4\.0b2; nokeepalive downgrade-1.0 force-response-1.0BrowserMatch RealPlayer 4\.0 force-response-1.0BrowserMatch Java/1\.0 force-response-1.0BrowserMatch JDK/1\.0 force-response-1.0BrowserMatch Microsoft Data Access Internet Publishing Provider redirect-carefullyBrowserMatch MS FrontPage redirect-carefullyBrowserMatch ^WebDrive redirect-carefullyBrowserMatch ^WebDAVFS/1.[0123] redirect-carefullyBrowserMatch ^gnome-vfs/1.0 redirect-carefullyBrowserMatch ^XML Spy redirect-carefullyBrowserMatch ^Dreamweaver-WebDAV-SCM1 redirect-carefullyThe only change I made was to add the ServerName.
What iptables command do I need to allow web server traffic?
centos;iptables
vi /etc/sysconfig/iptablesHave You got -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPTIf no add it into filters  and  /etc/init.d/iptables restartIf this won't help I don't know what can help You :)