Centos7服务器搭建网络家园和论坛

环境:Centos7

工具:mysql,php,httpd

目的:熟练掌握httpd服务器搭建和个服务器之间的配合。

有兴趣的朋友可以来实践一下,我会提供各种源码进行搭建。

网络家园和论坛源码:https://www.lanzous.com/i3yqq3c

(1)准备一台centos服务器,我是在虚拟机搭建的centos7.

(2)关闭防火墙和selinux等(centos7关闭防火墙和selinux

(3)搭建myql数据库(MySQL的rpm安装教程

(4)搭建httpd服务器(centos7自带httpd,只需要启动即可用)

(5)安装PHP服务器

  1. 安装
[root@wei ~]#  yum install php –y

安装php-mysql

[root@wei ~]# yum install php-mysql –y

2.测试php和apache协同

测试协同

[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim phpinfo.php



<?php

  phpinfo();

?>

              测试: http://IP/phpinfo.php

  1. 测试php和MySQL协同
[root@localhost html]# vim php_mysql.php

<?php
$servername = "localhost";
$username = "admin";
$password = "123456";

// 创建连接
//$con = mysql_connect($servername,$username,$password);
$conn = new mysqli($servername, $username, $password);

// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}
echo "连接成功";
?>

           测试: http://IP/php_mysql.php

(6)部署应用

1.上传代码(代码在上面)(代码上传到/var/www/html/目录)

 

2.解压

安装解压软件:

[root@localhost html]# yum install unzip –y

3.配置

改名:

[root@wei html]# mv upload/ farm

 

在线安装:

http://192.168.196.131/farm/install/index.php

1.问题一

修改/etc/php.ini, 将short_open_tag = On

vim /etc/php.ini

修改完毕,重启httpd服务。

[root@wei html]# systemctl restart httpd

2.问题二

修改目录权限:

[root@localhost html]# chmod -R 777 farm

 

让后进项下面步骤,进行在线安装

步骤一:

步骤二:

创建farm数据库和用户

[root@wei html]# mysql -u root -proot ##登录数据库
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database farm;   ##创建farm数据库
Query OK, 1 row affected (0.00 sec)

mysql> grant all on farm.* to farm@'localhost' identified by 'farm';  #创建用户,进行授权
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;  ##刷新权限表
Query OK, 0 rows affected (0.00 sec)

步骤三:

进行安装

 

步骤四:

进行测试

http://192.168.196.131/farm/bbs/

 

http://192.168.196.131/farm/

http://192.168.196.131/farm/home/space.php?do=home

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南宫乘风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值