LNMP代表的就是:Linux系統下Nginx+MySQL+PHP這種網站服務器架構。
(nginx主機)web 處理靜態內容 172.16.250.149
(fpm server mariad bserver)處理動態內容 172.16.253.131
以上為兩臺CentOS7.3主機
試驗拓撲圖如下:
===========================================================================
(fpm server mariad bserver) 172.16.253.131
#yum install php-fpm php-mysql php-mbstring php-mcrypt mariadb-server -y 下載phpMyAdmin-4.0.10.20-all-languages.tar.gz #vim /etc/php-fpm.d/www.conf listen = 0.0.0.0:9000 ;listen.allowed_clients = 127.0.0.1 pm.max_children = 150 pm.status_path = /status ping.path = /ping #mkdir /var/lib/php/session #chown apache:apache /var/lib/php/session #systemctl start php-fpm.service #ss -tnl | grep "9000" LISTEN 0 128 *:9000 *:* #mkdir /data/apps -pv #vim /data/apps/index.php #定義后端主頁 <?php phpinfo(); ?>
===========================================================================
(nginx主機)172.16.250.149
#vim /etc/nginx/conf.d/ilinux.conf
#vim /data/nginx/html/index.html #nginx server主頁
<h1>Nginx server</h1>
===========================================================================
(fpm server mariad bserver) 172.16.253.131
#vim /etc/my.cnf.d/server.cnf
關閉地址解析
#systemctl start mariadb.service #ss -tnl | grep "3306" LISTEN 0 50 *:3306 *:* #mysql_secure_installation Set root password? [Y/n] y #是否設置密碼 New password: #輸入要設置的密碼 Re-enter new password: Remove anonymous users? [Y/n] y #是否刪除匿名用戶 Disallow root login remotely? [Y/n]n #是否禁止管理員遠程登錄(為了試驗方便,設置成不要,生成中禁止遠程登錄) Remove test database and access to it? [Y/n]n #刪除測試數據庫 Reload privilege tables now? [Y/n]y #重載 #tar xf phpMyAdmin-4.0.10.20-all-languages.tar.gz -C /data/apps/ #cd /data/apps/ #ln -sv phpMyAdmin-4.0.10.20-all-languages pma #cd pma/ #vim config.inc.php $cfg['blowfish_secret'] = 'aqwer8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ #scp phpMyAdmin-4.0.10.20-all-languages.tar.gz 172.16.250.149:/root/
===========================================================================
(nginx主機)172.16.250.149
#tar xf phpMyAdmin-4.0.10.20-all-languages.tar.gz -C /data/nginx/html/ #cd /data/nginx/html/ #ln -sv phpMyAdmin-4.0.10.20-all-languages pma
===========================================================================
實驗相關擴展
(nginx主機)172.16.252.245
(nginx代理主機)172.16.250.149
(mariadb server)172.16.253.131
以上為三臺CentOS7.3主機
試驗拓撲圖如下:
===========================================================================
(nginx主機)172.16.252.245
#yum install nginx -y #mkdir /data/nginx/html -pv 下載phpMyAdmin-4.0.10.20-all-languages.tar.gz #tar xf phpMyAdmin-4.0.10.20-all-languages.tar.gz -C /data/nginx/html/ #cd /data/nginx/html/ #ln -sv phpMyAdmin-4.0.10.20-all-languages pma #vim /etc/nginx/nginx.conf
#nginx -t
#systemctl start nginx.service
===========================================================================
(nginx代理主機)172.16.250.149
#vim /etc/nginx/conf.d/ilinux.conf
===========================================================================
緩存相關
(nginx代理主機)172.16.250.149
#vim /etc/nginx/nginx.conf
#vim /etc/nginx/conf.d/ilinux.conf
#nginx -t
#nginx -s reload
#curl http://www.ilinux.io/pma/index.php
#ls /data/nginx/fcgicache/d4/41/c4/3eaa46f5754097b1e7ed0fe21fc441d4
/data/nginx/fcgicache/d4/41/c4/3eaa46f5754097b1e7ed0fe21fc441d4
#vim /etc/nginx/conf.d/ilinux.conf
#nginx -t
#nginx -s reload
獲取完整內容
原創文章,作者:Linux.rookie,如若轉載,請注明出處:http://www.www58058.com/82132