Finding the location on typical Linux/Unix servers is not very difficult. To do so, go into terminal/SSH and run the command:
ps -ef | grep httpd
Your output may differ slightly based on your operating system, but it should look something like:
0 48 1 0 7:22AM ?? 0:00.44 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON 70 165 48 0 7:22AM ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON 501 1247 1219 0 7:50AM ttys001 0:00.00 grep httpd
On certain operating systems, it may not return anything. In that case, try command:
ps -ef | grep apache2
If you don’t receive any results from both commands, you may not be running Apache/httpd. Nonetheless, you want to pay close attention to
/usr/sbin/httpd. That is the location to your binary file. Run the following command to obtain the location to your configuration file:
/usr/sbin/httpd -V | grep SERVER_CONFIG_FILE
You’ll see something like the following, which will designate the location for your httpd.conf file.
Reloading iptables rules on boot for CentOS and RHEL is simpler than for most other Linux Distributions. RHEL and its clone CentOS write its “permanent” iptables rules to the /etc/sysconfig/iptables file. Writing iptables rules is out of the scope of this article, so I won’t go over that today.
After you have applied your respective iptables rules, you may wish to check on your iptables rules before you save them. Use the following command to list all the current rules:
Use this command to save the iptables rules (the following command is the actual command to save the rules so they are applied on boot)
/sbin/service iptables save
The following command would allow you to double check that your rules have been saved. It is similar to
iptables -L, but also different. The previous command shows all the rules that are currently in effect, but many of those rules will not be applied after your system has been restarted. The following command will show all the rules that are currently in effect and have been written to disk, meaning they will apply even after a reboot.