您好,登錄后才能下訂單哦!
博客作業(yè):
(1)CentOS 7, apm+xcache, rpm包, php module;
a)一個虛擬主機提供phpMyAdmin,另一個虛擬主機提供wordpress;
b)為phpMyAdmim提供https服務(wù);
安裝篇:
一、安裝Apache
yum -y install httpd
systemctl start httpd.service #啟動apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重啟apache
systemctl enable httpd.service #設(shè)置apache開機啟動
在客戶端瀏覽器中打開服務(wù)器IP地址,會出現(xiàn)下面的界面,說明apache安裝成功
二、安裝mariadb
yum install mariadb mariadb-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成
systemctl start mariadb.service #啟動MariaDB
systemctl stop mariadb.service #停止MariaDB
systemctl restart mariadb.service #重啟MariaDB
systemctl enable mariadb.service #設(shè)置開機啟動
為root賬戶設(shè)置密碼
mysql_secure_installation
回車,根據(jù)提示輸入Y
輸入2次密碼,回車
根據(jù)提示一路輸入Y
最后出現(xiàn):Thanks for using MySQL!
MySql密碼設(shè)置完成,重新啟動 MySQL:
systemctl restart mariadb.service #重啟MariaDB
mysql -uroot -p 登陸測試
三、安裝php
[root@centos7 yum.repos.d]# yum install php
四、安裝php組件php-mysql以連接mariadb
yum install php-mysql
systemctl restart mariadb.service #重啟MariaDB
systemctl restart httpd.service #重啟apache
五、安裝xcache
yuminstall php-xcache
apachectlstop
apachectlstart
六、做相關(guān)的配置
1、vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.html #修改為:DirectoryIndex index.html index.htmDefault.html Default.htm index.php(設(shè)置默認(rèn)首頁文件,增加index.php)
2、vim /etc/php.ini
date.timezone = PRC #把前面的分號去掉,改為date.timezone = PRC
3、cd /var/www/html
vi index.php #輸入下面內(nèi)容
<?php
phpinfo();
?>
4、chown apache.apache -R /var/www/html
七、配置虛擬主機1提供phpMyAdmin,虛擬主機2提供wordpress
虛擬主機
基于端口設(shè)置兩個虛擬主機
mkdir/var/www/vhost1
mkdir/var/www/vhost2
vim/etc/httpd/conf.d/vhost1.conf
vim/etc/httpd/conf.d/vhost2.conf
內(nèi)容如下:
虛擬主機1
<VirtualHost192.168.1.70:80>
ServerNamewww1.magedu.com
DocumentRoot/var/www/vhost1
CustomLoglogs/www1-access_log combined
</VirtualHost>
虛擬主機2
<VirtualHost192.168.1.70:8080>
ServerName www1.magedu.com
DocumentRoot /var/www/vhost1
CustomLog logs/www1-access_log combined
</VirtualHost>
虛擬主機2配置wordpress
下載wordpress源碼包,拷貝到/var/www/vhost2
解壓配置mv wp-config-sample.conf wp-config.conf
mysql -uroot -p
GRANT ALL ON wpdb.* TO 'wpuser'@'192.168.%.%'IDENTIFIED BY 'wppass';
CREATE DATABASE wpdb;
http://192.168.1.70:8080/wordpress/wp-admin/install.php
虛擬主機1配置phpmyadmin
yum install phpmyadmin (需要yum源配置epel庫)
http://192.168.1.70/phpmyadmin/出現(xiàn)頁面是代碼,原因是裝了php-fpm,沒裝php模塊
vim /etc/httpd/conf.d/phpMyAdmin.conf 需配置允許訪問的ip地址
為虛擬主機1上的phpmyadmin提供https服務(wù)
(1)#cd /etc/pki/CA
#(umask 077;openssl genrsa -outprivate/cakey.pem 2048)
#openssl req -new -x509 -key private/cakey.pem-out cacert.pem(生成簽署請求)
CN
Beijing
...
#touch index.txt
#echo 01 > serial
(2) 配置httpd支持使用ssl,及使用的證書;
# yum -y install mod_ssl
# mkdir /etc/httpd/ssl
#(umask 077;openssl genrsa -out httpd.key1024)(在ssl目錄下)
#openssl req -new -key httpd.key -out httpd.csr
配置文件:/etc/httpd/conf.d/ssl.conf
DocumentRoot
ServerName
SSLCertificateFile
SSLCertificateKeyFile
(3) 測試基于https訪問相應(yīng)的主機;
# openssl s_client [-connect host:port][-cert filename] [-CApath directory] [-CAfile filename]
openssl s_client -connect 192.168.1.70:443-CAfile /etc/pki/CA/cacert.pem
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。