標籤:
網站素材在:https://i.cnblogs.com/Files.aspx
首先需要搭建本地yum源,詳情參考:
http://www.cnblogs.com/jw35/p/5967677.html
我使用Centos 7 做網站伺服器,Centos 5 存放資料
先配置centos 7
配置IP
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 #編輯網卡設定檔,eno16777736為網卡名字
我Centos 7設定的IP為192.168.100.135
yum install httpd -y #安裝Apache服務yum install php -y #安裝php服務yum install php-mysql -y #使php與mysql相串連systemctl stop firewalld.service #臨時關閉防火牆setenforce 0 #臨時關閉selinux
將網站檔案上傳到/var/www/html 目錄下
修改 connect.php 檔案
$host="192.168.100.235"; #地址$db_user="aa01"; #使用者名稱$db_pass="123"; #密碼$db_name="xyq"; #庫名
重啟Apache
systemctl restart httpd.service
centos 5 配置
配置IP
ifconfig eth0 192.168.100.235 255.255.255.0 #給eth0網卡臨時添加IP
service iptables stop #臨時關閉防火牆
setenforce 0 #臨時關閉selinux
搭建本地yum源
yum install mysql-server -y #安裝mysqlservice mysqld restart #重啟mysqlmysql #進入資料庫show databases; #查看所有資料庫create user ‘aa01‘@‘192.168.100.135‘ identified by ‘123‘; #給192.168.100.135建立使用者,即建立的使用者只能在192.168.100.135上登入create database xyq; #建立xyq資料庫grant all privileges on xyq.* to ‘aa01‘@‘192.168.100.135‘; #給某個使用者加上指定資料庫的許可權,*代表所有的表use xyq; #進入資料庫show tables #查看錶
然後將SQL語句複製進去
quit #退出資料庫
最終如下
linux 搭建php網站許願牆