Method 1: one-click installation of http://lnmp.org/
Method 2: Install yum
Preparation:
1. configure the firewall and enable port 80 and port 3306.
VI/etc/sysconfig/iptables
-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept (allow port 80 to pass through the firewall)
-A input-M state -- state new-m tcp-p tcp -- dport 3306-J accept (allow port 3306 to pass the firewall)
Note: many users add these two rules to the last line of the firewall configuration, which causes firewall startup failure. The correct rule should be added to the default port 22.
The firewall rules are as follows:
######################################## #################
# Firewall configuration written by system-config-Firewall
# Manual customization of this file is not recommended.
* Filter
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
-A input-M state -- State established, related-J accept
-A input-p icmp-J accept
-A input-I lo-J accept
-A input-M state -- state new-m tcp-p tcp -- dport 22-J accept
-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept
-A input-M state -- state new-m tcp-p tcp -- dport 3306-J accept
-A input-J reject -- reject-with ICMP-host-prohibited
-A forward-J reject -- reject-with ICMP-host-prohibited
Commit
######################################## #################
/Etc/init. d/iptables restart # restart the firewall to make the configuration take effect.
Note: If the iptables file cannot be found, run iptables-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept first.
Then:After the service iptables save is saved, restart to have the iptables file.
2. Disable SELinux
VI/etc/SELinux/config
# SELinux = enforcing # comment out
# Selinuxtype = targeted # comment out
SELinux = disabled # Add
: WQ save, close
Shutdown-R now # restart the system
Note: Why is it disabled? Because the security is too high, it is generally difficult to control
Installation:
1. Install nginx
Yum install nginx # Install nginx. Enter y as prompted to install nginx.
Service nginx start # Start
Chkconfig nginx on # Set to boot
/Etc/init. d/nginx restart # restart
Rm-RF/usr/share/nginx/html/* # Delete the default ngin test page
Http://blog.csdn.net/ltx851201/article/details/7893295
To be continued
Install lnmp in centos