CentOS-7-64bit 配置Apache + MySQL + PHP
一、配置防火牆,開啟80埠、3306埠
CentOS 7.0預設使用的是firewall作為防火牆,這裡改為iptables防火牆。
1、關閉firewall:
#停止firewall服務
- systemctl stop firewalld.service
- systemctl disable firewalld.service
2、安裝iptables防火牆
#安裝
- yum install iptables-services
- vi /etc/sysconfig/iptables
# 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
:wq! #儲存退出
#最後重啟防火牆使配置生效
- systemctl restart iptables.service
- systemctl enable iptables.service
二、關閉SELINUX
#修改配置檔案
- vi /etc/selinux/config
#SELINUX=enforcing #註釋掉
#SELINUXTYPE=targeted #註釋掉
SELINUX=disabled #增加
:wq! #儲存退出
#使配置立即生效
- setenforce 0
三.安裝apache
- yum install httpd
可能會用到的:
systemctl start httpd.service #啟動apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重啟apache
systemctl enable httpd.service #設定apache開機啟動
restart一下,然後:
輸入localhost
出現之後代表已經安裝上去了。
四.安裝mysql
方法參考
http://blog.itpub.net/29773961/viewspace-1248176/
方法大致相同
在centos7中可以用:
- rpm -ivh mysql-community-release-el6-5.noarch.rpm
關於這一步驟,在目前能夠找到的centos7配置教程上,大多都是安裝mariadb,因為centos7預設將mariadb視作mysql。
p.s.因為mysql被oracle收購後,原作者擔心mysql閉源,所以又寫了一個mariadb,這個資料庫可以理解為mysql的分支。
我在此處還是安裝mysql
如果需要安裝mariadb,只需透過yum就可。
五.安裝php
- yum install php
- yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
- systemctl restart mysqld.service
-
systemctl restart httpd.service
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29773961/viewspace-1261417/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux+Apache+Mysql+PHP典型配置LinuxApacheMySqlPHP
- Apache + PHP配置ApachePHP
- Windows+Apache+PHP+MySQL+PHPMyadmin的配置WindowsApachePHPMySql
- Windows下64位Apache+PHP+MySQL配置WindowsApachePHPMySql
- 在Mac OS X中配置Apache + PHP + MySQLMacApachePHPMySql
- 配置Apache2.2+PHP5+CakePHP1.2+MySQL5ApachePHPMySql
- LAMP環境(linux+apache+mysql+php)配置LAMPLinuxApacheMySqlPHP
- 在Mac OS X中配置Apache+PHP+MySQLMacApachePHPMySql
- linux下Apache+PHP+MySQL安裝配置攻略LinuxApachePHPMySql
- Win10配置Apache2.4+PHP7+MySQL5.7Win10ApachePHPMySql
- 在MacOSX10.8中配置Apache+PHP+MySQLMacApachePHPMySql
- 在Debian上配置Apache+MySQL+PHP4(轉)ApacheMySqlPHP
- PHP1:在Windows上安裝和配置PHP,Apache和MySQLPHPWindowsApacheMySql
- apache+mysql4+phpApacheMySqlPHP
- Centos中檢視nginx、apache、php、mysql配置檔案路徑CentOSNginxApachePHPMySql
- Windows7環境下Apache+PHP+MySQL完美配置WindowsApachePHPMySql
- Redhat9.0 Apache2+Php5.0+Mysql4.0配置(轉)RedhatApachePHPMySql
- win7下手動配置apache+php+mysql記Win7ApachePHPMySql
- CentOS+Apache+Mysql+Php安裝及優化配置小記CentOSApacheMySqlPHP優化
- 無廢話 apache+mysql+php+snmp+rrdtool+cacti 配置(轉貼)ApacheMySqlPHP
- linux+mysql+apache+phpLinuxMySqlApachePHP
- Windows 配置 Apache2.4+php5.6WindowsApachePHP
- [php]apache虛擬主機配置PHPApache
- php和apache2的配置PHPApache
- CentOS 6.6安裝配置LAMP伺服器(Apache+PHP5+MySQL)CentOSLAMP伺服器ApachePHPMySql
- Windows下PHP 5.6+Apache 2.4+MySQL 5.5安裝與配置WindowsPHPApacheMySql
- Apache+php+mysql在windows下的安裝與配置圖解ApachePHPMySqlWindows圖解
- Linux+Apache2+Mysql+Php安裝配置及其mysql字元設定錯誤LinuxApacheMySqlPHP字元
- nginx+LAMP(apache+php+mysql)NginxLAMPApachePHPMySql
- apache、php、mysql安裝過程ApachePHPMySql
- aliyun install php apache mysql nginxPHPApacheMySqlNginx
- Apache、php、mysql(最新安裝版)ApachePHPMySql
- mysql和apache不認識phpMySqlApachePHP
- Apache+PHP5+MySQL4(5)+PHPMyAdmin 的簡易安裝配置ApachePHPMySql
- PHP4 + MYSQL + APACHE 在 WIN 系統下的安裝、配置 (轉)PHPMySqlApache
- Linux配置APACHE2.0.55 +PHP5.1.1+MYSQL5.0.16+GD庫(轉)LinuxApachePHPMySql
- linux下配置APACHE2.0.50+PHP5.0.3+MYSQL4.0.20+GD庫(轉)LinuxApachePHPMySql
- Apache+php在windows下的配置ApachePHPWindows