CentOS 7 搭建 LAMP

一、安装httpd

  1、yum install httpd -y

  2、启动服务:systemctl start httpd

  3、设置开机启动:systemctl enable

二、安装mariadb

  1、yum groupinstall mariadb

  2、启动服务:systemctl start mariadb

  3、设置开机启动:systemctl enable mariadb

三、安装php

  1、yum install php

  2、yum install php-mysql php-gd libjpeg* php-ldap php-odbc  php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

  3、重启服务: systemctl restart httpd,systemctl restart httpd

四、安装ngnix

  1 、安装依赖文件:yum install gcc-c++  pcre pcre-devel zlib zlib-devel -y

  2、下载nginx: wget  http://nginx.org/download/nginx-1.9.8

  3、解压文件: tar  -zxvf  nginx1.9.8.tar.gz

  4、cd /nginx1.9.8

  5、./configure,接着是make  ,  make install

  6、启动服务:/usr/local/nginx/sbin/nginx  , 然后查看启动情况 :  ps -aux |grep

五、添加防火墙

  1、firewall-cmd  --permanent  --add-rich-rule="rule family=ipv4 service name=http source address=10.0.0.0/24 accept"

  2、firewall-cmd --reload

六、测试页制作:

  1、/var/www/html/里添加文件为index.php,然后在里面创建添加代码: <?php  echo "hello wolrd"?  >

七、windows下访问 :  http://10.0.0.21/index.php

猜你喜欢

转载自blog.csdn.net/a4132447/article/details/95116664