Q. How do I open port 80 (Apache Web Server) under Red Hat / CentOS / Fedora Linux?
A. The default configuration file for iptables based firewall under RHEL / CentOS / Fedora Linux is /etc/sysconfig/iptables. Open this file using a text editor such as vi:
Linux Open Port 80 (http)
Append rule as follows:
-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
Save and close the file. Restart iptables:
There are different ways to set up Virtual Hosts, however I recommend the method below. By default, Apache listens on all IP addresses available to it.
Now we will create virtual host entries for each site that we need to host with this server. Here are two examples for sites at “example.com” and “example.org”.
CustomLog /var/www/khabbazi.nl/logs/access.log combined
Notes regarding this example configuration:
- All of the files for the sites that you host will be located in directories that exist underneath /srv/www You can symbolically link these directories into other locations if you need them to exist in other places.
- ErrorLog and CustomLog entries are suggested for more fine-grained logging, but are not required. If they are defined (as shown above), the logs directories must be created before you restart Apache.
Before you can use the above configuration you’ll need to create the specified directories. For the above configuration, you can do this with the following commands:
mkdir -p /srv/www/example.com/public_html