配置防火墙,允许80端口通过防火墙(添加到默认的22端口规则的下面) vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #memcached -A INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT /etc/init.d/iptables restart
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm yum install mysql.`uname -i` yum-plugin-replace yum replace mysql --replace-with mysql55w yum install mysql55w mysql55w-server chkconfig --levels 235 mysqld on /etc/init.d/mysqld start mysql_secure_installation
yum install httpd chkconfig --levels 235 httpd on /etc/init.d/httpd start
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm yum remove php-common #如果以前安装过其他版本PHP,则需要执行此操作 yum install php55w yum install php55w-mysql php55w-mysqli php55w-pdo php55w-mbstring php55w-gd php55w-intl php55w-mcrypt php55w-pecl-memcache php55w-pecl-apc php55w-pecl-zendopcache php55w-xml php55w-xmlrpc php55w-imap php55w-ldap php55w-odbc php55w-pear php --version /etc/init.d/httpd restart
yum install memcached chkconfig --levels 235 memcached on /etc/init.d/memcached start
设置VirtualHost: vi /etc/httpd/conf.d/xxx.conf <VirtualHost *:80> ServerName xxx.com DocumentRoot /var/www/html/xxx.com ErrorLog /var/log/xxx.com-error_log CustomLog /var/log/xxx.com-access_log common </VirtualHost>
如果出现: [warn] _default_ VirtualHost overlap on port 80, the first has precedence 则需将 /etc/httpd/conf/httpd.conf 中的 #NameVirtualHost *:80去掉注释
禁止IP直接访问,防止恶意解析: vi /etc/httpd/conf.d/default.conf <VirtualHost *:80> <Location /> Order Allow,Deny Deny from all </Location> </VirtualHost>
vi /etc/httpd/conf/httpd.conf 去除 Indexes。 隐藏系统版本:修改ServerTokens OS为ServerTokens Prod vi /etc/php.ini date.timezone = PRC #禁止显示php版本的信息 expose_php = Off