您好,登錄后才能下訂單哦!
LAMP的定義:
lamp:指Linux(操作系統)、Apache(HTTP 服務器)、MySQL/MariaDB(數據庫軟件) 、以及PHP/perl/python(j腳本語言)所組成的架構,一般用于建立web應用平臺。
環境:本地系統操作,無防火墻影響。
系統: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 ——安裝所需服務安裝包
[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 ——重啟服務,并保證永久生效
[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數據庫
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與數據庫連接
if ($conn)
echo “OK”;
else
echo “NO”;
?>
[root@localhost /]setenforce 0 ——關閉selinux
[root@localhost /]firefox localhost ——測試頁面顯示“OK”,則配置成功
上傳博客wordpress-3.3.1-zh_CN.zip到根目錄
[root@localhost /]unzip wordpress-3.3.1-zh_CN.zip ——解壓開發好的博客壓縮包
[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/ ——移動到/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 ——更改配置文件,博客與數據庫相關聯
// ** MySQL 設置 - 具體信息來自您正在使用的主機 ** //
/** WordPress 數據庫的名稱 */
define('DB_NAME', 'wpdb');
/** MySQL 數據庫用戶名 */
define('DB_USER', 'wpuser');
/** MySQL 數據庫密碼 */
define('DB_PASSWORD', 'wppass');
/** MySQL 主機 */
define('DB_HOST', '172.25.254.3');
火狐訪問主機:localhost/wordpress,按需求安裝wordpress
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。