This post is intended for programmers developing projects with PHP but have not been encouraged to install GNU / Linux.
Not to lose focus on what we need, conserve resources and minimize the administration, we always recommend a minimal installation of Debian and then we’ll install the rest.
After installing the operating system to install APACHE proceed with MySQL and PHP:
# Apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql phpmyadmin
The root-folder of the webserver is in / var / www / but you can change or set up links, a task that is a bit more advanced.
The next step is to configure the firewall, if the computer is accessible from the Internet or a network with many computers. The same is not restrictive (all traffic is denied unless you explicitly allow) but permissive.
# / Bin / bash PATH = / usr / sbin: / sbin: / bin: / usr / bin # change eth0 for the local interface in the case of another LAN = “eth0” # ——– INITIALIZATION ———— ——————– iptables-F iptables-t nat-F iptables-t mangle-F iptables – X # ———————– ———————– LOOPBACK iptables -A INPUT-i lo-j ACCEPT # —————— —————– iptables FILTER PACKAGES – A INPUT-m state – state ESTABLISHED, RELATED-j ACCEPT iptables-A INPUT-m state – state NEW-i! eth1-j ACCEPT # ————————- ——————- ROUTING —– echo 1> / proc/sys/net/ipv4/ip_forward # ————————- —– SSH ——————- $ IPTABLES-A INPUT-i $ LAN-p tcp – dport 22-j ACCEPT # ———– ———————— ————– HTTP $ IPTABLES-A INPUT-i $ LAN-p tcp – dport 80-j ACCEPT
A script should give an execute permissions:
chmod 744 firewall
Now we can add it in two places: the system start or in the folder / etc / network / if-up (run whenever the system detects that a network interface up a link.)
For this example we will assign within the system boot sequence. For that you must copy the script to the folder / etc / init.d / and create links to it in each init.
cp firewall / etc / init.d
update-rc.d firewall defaults 80