實(shí)驗(yàn)需求:

LNMP實(shí)現(xiàn)多個虛擬主機(jī),部署wordpress和phpmyadmin,并為phpmyadmin提供https
實(shí)驗(yàn)環(huán)境:
LNMP CentOS 7.2x86_64 IP:172.16.251.138
測試端 CentOS 6.7x86_64 IP:172.16.251.164
軟件包:
initial-setup-ks.cfg
mariadb-5.5.46-linux-x86_64.tar.gz
nginx-1.10.0.tar.gz
php-5.4.26.tar.bz2
phpMyAdmin-4.4.14.1-all-languages.zip
wordpress-4.3.1-zh_CN.zip
實(shí)驗(yàn)準(zhǔn)備:
安裝開發(fā)包組,支持軟件,解決依賴關(guān)系
[root@station138 ~]# iptables -F
[root@station138 ~]# setenforce 0
[root@station138 ~]# yum groupinstall"Development Tools" "Server Platform Development"
[root@station138 ~]# yum -y installpcre-devel openssl-devel zlib-devel
編譯安裝nginx:
[root@station138 ~]# tar xfnginx-1.10.0.tar.gz
1.創(chuàng)建程序用戶:
[root@station138 nginx-1.10.0]# useradd -rnginx
2.進(jìn)入目錄開始編譯:
[root@station138 nginx-1.10.0]# ./configure--prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid--lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module--with-http_dav_module --with-http_stub_status_module --with-threads--with-file-aio
[root@station138 nginx-1.10.0]# make&& make install
3.檢查配置文件:
[root@station138 nginx-1.10.0]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
4.啟動服務(wù):
[root@station138 nginx-1.10.0]# nginx
[root@station138 nginx-1.10.0]# netstat-anpt |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 38873/nginx: master
5.創(chuàng)建虛擬主機(jī):
[root@station138 ~]# mkdir -pv /var/www/v{1,2}
[root@station138 ~]# echo "web1" >> /var/www/v1/index.html
[root@station138 ~]# echo "web2" >> /var/www/v2/index.html
[root@station138 ~]# vim/etc/nginx/nginx.conf
server {
listen 80;
server_name www.a.com;
location / {
root /var/www/v1;
index index.php index.htmlindex.htm;
}
}
server {
listen 80;
server_name www.b.com;
location / {
root /var/www/v2;
index index.php index.html index.htm;
}
}
[root@station138 ~]# nginx -s reload
6.客戶端測試:


二進(jìn)制安裝mariadb:
1.建立mysql系統(tǒng)用戶
[root@station138~]# useradd -r -M mysql
2.建立數(shù)據(jù)存放的目錄
[root@station138~]# mkdir -p /testdir/mydata
[root@station138~]# chown -R mysql.mysql /testdir/mydata
3.解壓mariadb安裝包
[root@station138 ~]#tar xf mariadb-5.5.46-linux-x86_64.tar.gz -C /usr/local
[root@station138~]# ln -sv /usr/local/mariadb-5.5.46-linux-x86_64/ mysql
[root@station138~]# chown -R root.mysql /usr/local/mysql/*
4.使用scripts腳本文件mysql_install_db文件來安裝數(shù)據(jù)庫
[root@station138mysql]# scripts/mysql_install_db --user=mysql --datadir=/testdir/mydata
5.提供配置文件
[root@station138mysql]# cp support-files/my-large.cnf /etc/my.cnf
[root@station138mysql]# vim /etc/my.cnf
datadir=/testdir/mydata //指明mysql的數(shù)據(jù)存放路徑
innodb_file_per_table = ON //成為獨(dú)立表空間
skip_name_resolve = ON //跳過名稱解析
6.提供mysql服務(wù)啟動腳本
[root@station138 support-files]# cp mysql.server /etc/rc.d/init.d/mysqld
[root@station138 support-files]# chkconfig --add mysqld
7.添加環(huán)境變量
[root@station138 ~]# vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
[root@station138 ~]# source /etc/profile.d/mysql.sh
8.導(dǎo)出頭文件,導(dǎo)出庫文件:
[root@station138 ~]#ln -s /usr/local/include/ /usr/include/mysql
[root@station138 ~]#vim /etc/ld.so.conf.d/mysql.conf
9.啟動服務(wù)
[root@station138 ~]# systemctl start mysqld
[root@station138 ~]# ss -tnl
LISTEN 0 50 *:3306 *:*
源代碼安裝PHP:
1.安裝支持軟件,解決依賴關(guān)系:
[root@station138 ~]# yum -y install bzip2-devel libmcrypt-devel libxml2-devel openssl-devel
2.編譯php
[root@station138 ~]# tar xf php-5.4.26.tar.bz2另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁題目:NGINX網(wǎng)站服務(wù)-LNMP平臺及應(yīng)用-創(chuàng)新互聯(lián)
URL分享:http://www.yijiale78.com/article14/docdge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、外貿(mào)網(wǎng)站建設(shè)、微信小程序、網(wǎng)站設(shè)計(jì)、做網(wǎng)站、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容