您好,登錄后才能下訂單哦!
LAMP的定義:
lamp:指Linux(操作系統(tǒng))、Apache(HTTP 服務(wù)器)、MySQL/MariaDB(數(shù)據(jù)庫軟件) 、以及PHP/perl/python(j腳本語言)所組成的架構(gòu),一般用于建立web應(yīng)用平臺(tái)。
環(huán)境:本地系統(tǒng)操作,無防火墻影響。
系統(tǒng):CentOS7.0
ip:172.25.254.3
[root@localhost /]cat /etc/yum.repo/server.repo ——配置yum倉庫(本地)
[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 ——配置主頁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 -h 172.25.254.3 -p ——測試testuser登錄testdb數(shù)據(jù)庫
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ù)庫連接
if ($conn)
echo “OK”;
else
echo “NO”;
?>
[root@localhost /]setenforce 0 ——關(guān)閉selinux
[root@localhost /]firefox localhost ——測試頁面顯示“OK”,則配置成功
上傳博客wordpress-3.3.1-zh_CN.zip到根目錄
[root@localhost /]unzip wordpress-3.3.1-zh_CN.zip ——解壓開發(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訪問
[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ù)庫相關(guān)聯(lián)
// ** MySQL 設(shè)置 - 具體信息來自您正在使用的主機(jī) ** //
/** WordPress 數(shù)據(jù)庫的名稱 */
define('DB_NAME', 'wpdb');
/** MySQL 數(shù)據(jù)庫用戶名 */
define('DB_USER', 'wpuser');
/** MySQL 數(shù)據(jù)庫密碼 */
define('DB_PASSWORD', 'wppass');
/** MySQL 主機(jī) */
define('DB_HOST', '172.25.254.3');
火狐訪問主機(jī):localhost/wordpress,按需求安裝wordpress
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。