LAMP網(wǎng)站架構(gòu)的基礎(chǔ)構(gòu)思及搭建解析——CentOS7.0

LAMP的定義:

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、微信小程序、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了劍河免費(fèi)建站歡迎大家使用!

lamp:指Linux(操作系統(tǒng))、Apache(HTTP 服務(wù)器)、MySQL/MariaDB(數(shù)據(jù)庫(kù)軟件) 、以及PHP/perl/python(j腳本語(yǔ)言)所組成的架構(gòu),一般用于建立web應(yīng)用平臺(tái)。

環(huán)境:本地系統(tǒng)操作,無(wú)防火墻影響。

系統(tǒng):CentOS7.0 

ip:172.25.254.3

[root@localhost /]cat /etc/yum.repo/server.repo     ——配置yum倉(cāng)庫(kù)(本地)

[base]

name=server

baseurl=file:///mnt 

eabled=1

gpgcheck=0

[root@localhost /]mount /dev/cdrom /mnt         

[root@localhost /]yum -y install php php-mysql httpd mariadb-server     ——安裝所需服務(wù)安裝包

[root@localhost /]cat /var/www/html/index.php        ——配置主頁(yè)php文件

 

<?php

phpinfo();

?>

[root@localhost /]systemctl restart httpd ; systemctl enable httpd ;systemctl restart mariadb ;systemctl enable mariadb                    ——重啟服務(wù),并保證永久生效

[root@localhost /]firefox localhost         

[root@localhost /]mysql

MariaDB [(none)]>GRANT ALL ON testdb.* TO testuser@'%' IDENTIFIED BY 'testpass'; 

 

                                                                                                      ——允許testuser用戶以任何形式登錄

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>FLUSH PRIVILEGES;                                ——立即生效

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

 

Bye

 

[root@localhost /]# mysql -u testuser -h172.25.254.3  -p                 ——測(cè)試testuser登錄testdb數(shù)據(jù)庫(kù)

Enter password:testpass

 

Welcome to the MariaDB monitor. Commands end with ; or \g.

 

Your MariaDB connection id is 3

 

Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>exit

Bye

[root@localhost /]vim /var/www/html/index.php       

<?php

$conn = mysql_connect(“172.25.254.3”,”testuser”,”testpass”);  ——配置php與數(shù)據(jù)庫(kù)連接

if ($conn)

echo“OK”;

else

echo“NO”;

?>

[root@localhost /]setenforce 0                 ——關(guān)閉selinux

[root@localhost /]firefox localhost            ——測(cè)試頁(yè)面顯示“OK”,則配置成功


上傳博客wordpress-3.3.1-zh_CN.zip到根目錄

[root@localhost /]unzip wordpress-3.3.1-zh_CN.zip         ——解壓開(kāi)發(fā)好的博客壓縮包

[root@localhost /]# ls

bin    etc   lib64   opt   run   sys  var

boot   home   media   proc   sbin  tmp  wordpress

dev    lib   mnt    root   srv   usr  wordpress-3.3.1-zh_CN.zip

[root@localhost /]# mv wordpress /var/www/html/     ——移動(dòng)到/var/ww/html可供web訪問(wèn)

[root@localhost /]# cd /var/www/html/

[root@localhost html]# cd wordpress/

[root@localhost wordpress]# ls

index.php          wp-config-sample.php         wp-pass.php

license.txt         wp-content               wp-register.php

readme.html         wp-cron.php              wp-settings.php

wp-activate.php      wp-includes              wp-signup.php

wp-admin           wp-links-opml.php         wp-trackback.php

wp-app.php         wp-load.php              xmlrpc.php

wp-blog-header.php    wp-login.php

wp-comments-post.php   wp-mail.php

[root@localhost wordpress]# cp wp-config-sample.php wp-config-sample.php.back   ——備份

[root@localhost wordpress]# mv wp-config-sample.php wp-config.php     ——改名為配置文件名

[root@localhost wordpress]# mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 10

Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>GRANT ALL ON wpdb.* TO wpuser@'%' IDENTIFIED BY 'wppass';

Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]>create database wpdb;

Query OK, 1 row affected (0.02 sec)

MariaDB [(none)]>FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>exit

Bye

[root@localhost wordpress]# vim wp-config.php          ——更改配置文件,博客與數(shù)據(jù)庫(kù)相關(guān)聯(lián)

// ** MySQL 設(shè)置-具體信息來(lái)自您正在使用的主機(jī)** //

/** WordPress 數(shù)據(jù)庫(kù)的名稱*/

define('DB_NAME', 'wpdb');

/** MySQL 數(shù)據(jù)庫(kù)用戶名*/

define('DB_USER', 'wpuser');

/** MySQL 數(shù)據(jù)庫(kù)密碼*/

define('DB_PASSWORD', 'wppass');

/** MySQL 主機(jī)*/

define('DB_HOST', '172.25.254.3');

火狐訪問(wèn)主機(jī):localhost/wordpress,按需求安裝wordpress

網(wǎng)站欄目:LAMP網(wǎng)站架構(gòu)的基礎(chǔ)構(gòu)思及搭建解析——CentOS7.0
網(wǎng)頁(yè)網(wǎng)址:http://muchs.cn/article22/iidojc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)域名注冊(cè)、關(guān)鍵詞優(yōu)化網(wǎng)站內(nèi)鏈、ChatGPT、定制網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開(kāi)發(fā)