新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
CentOS上yum方式安裝配置LNMP
實(shí)驗(yàn)環(huán)境
- 一臺(tái)最小化安裝的centos 7.3虛擬機(jī)
安裝軟件包
yum install -y epel-*
yum install -y nginx mariadb-server php php-MySQL \
php-fpm php-pdo php-pdo_dblib php-gd php-pear \
php-xml php-pecl-zip php-json php-devel wget vim
配置nginx支持PHP
1.建立nginx的web主目錄
mkdir /var/wwwroot
cd /var/wwwroot
echo -e hello_world >> index.html
echo -e "" >> info.php
2.編輯nginx的配置文件
vim /etc/nginx/nginx.conf
3.修改nginx主目錄和索引
- 將
http下的server下的root的值修改為/var/wwwroot - 在
http下的server下添加index index.php index.html index.htm
4.在http下的server區(qū)塊加入以下內(nèi)容
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
5.啟動(dòng)nginx和php-fpm
systemctl start nginx php-fpm
systemctl enable nginx php-fpm
6.關(guān)閉防火墻
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
7.在宿主機(jī)訪(fǎng)問(wèn)nginx
訪(fǎng)問(wèn)http://[centos_ip]/info.php

成都創(chuàng)新互聯(lián)-專(zhuān)業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性?xún)r(jià)比大新網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式大新網(wǎng)站制作公司更省心,省錢(qián),快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋大新地區(qū)。費(fèi)用合理售后完善,十多年實(shí)體公司更值得信賴(lài)。
配置MySQL
1.啟動(dòng)MySQL
systemctl start mariadb
systemctl enable mariadb
2.輸入以下命令,配置MySQL
mysql_secure_installation
3.提示Enter current password for root (enter for none):
敲擊回車(chē)
4.提示Set root password? [Y/n]
按Y,隨后設(shè)置密碼
5.提示Remove anonymous users?
意思為是否刪除匿名用戶(hù)
6.提示Disallow root login remotely?
意思為遠(yuǎn)程禁止root登錄嗎?
7.提示Remove test database and access to it?
意思為刪除測(cè)試數(shù)據(jù)庫(kù)嗎?
8.提示Reload privilege tables now?
意思為現(xiàn)在重新加載特權(quán)表嗎?
9.登錄mysql數(shù)據(jù)庫(kù)
mysql -uroot -p
下載WordPress測(cè)試LNMP環(huán)境
1.下載WordPress
cd /var/wwwroot
rm -rf index.html
rm -rf info.php
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
tar -zxvf wordpress-4.9.4-zh_CN.tar.gz
cp -rf /var/wwwroot/wordpress/* /var/wwwroot
cd /var/wwwroot
rm -rf wordpress
chmod -R 777 *
2.登錄mysql創(chuàng)建數(shù)據(jù)庫(kù)
mysql -uroot -p
CREATE DATABASE wordpress;
3.在宿主機(jī)訪(fǎng)問(wèn)nginx服務(wù)器
訪(fǎng)問(wèn)http://[centos_ip]/
按提示安裝即可
當(dāng)前題目:CentOS上yum方式安裝配置LNMP
文章源于:http://www.dlmjj.cn/article/cdchsdo.html


咨詢(xún)
建站咨詢(xún)
