真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

LNMP博客以及數(shù)據(jù)庫分離搭建實(shí)戰(zhàn)

nginx搭建命令

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計制作、網(wǎng)站設(shè)計、海曙網(wǎng)絡(luò)推廣、小程序定制開發(fā)、海曙網(wǎng)絡(luò)營銷、海曙企業(yè)策劃、海曙品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供海曙建站搭建服務(wù),24小時服務(wù)熱線:18982081108,官方網(wǎng)址:www.cdcxhl.com

cd /home/oldboy/tools 安裝存放軟件包路徑

yum install openssl openssl-devel -y 安裝Nginx所需的庫、和加密協(xié)議 

yum install pcre pcre-devel -y 安裝Nginx所需的庫、和加密協(xié)議

rpm -qa openssl-devel pcre-devel  openssl openssl-devel 檢查是否安裝好

wget -q http://nginx.org/download/nginx-1.6.3.tar.gz 下載軟件包

useradd www -s /sbin/nologin -M  創(chuàng)建用戶

tar xf nginx-1.6.3.tar.gz 解壓軟件

cd nginx-1.6.3

./configure --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --prefix=/application/nginx-1.6.3/ 編譯安裝

make 

make install

ln -s /application/nginx-1.6.3/ /application/nginx 

/application/nginx/sbin/nginx 開啟服務(wù)

ps -ef|grep nginx 檢查

創(chuàng)建網(wǎng)頁目錄

[root@web02 html]# mkdir {www,bbs,blog} -p

[root@web02 www]# echo "www.etiantian.org" >index.html

修改主配置文件

添加access日志及虛擬主機(jī)目錄

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                       '$status $body_bytes_sent "$http_referer" '

                       '"$http_user_agent" "$http_x_forwarded_for"';

#nginx vhosts config

    include extra/www.conf;

    include extra/bbs.conf;

    include extra/blog.conf;

創(chuàng)建存放虛擬主機(jī)的目錄

[root@web02 conf]# mkdir extra

[root@web02 extra]# touch www.conf

[root@web02 extra]# touch bbs.conf

[root@web02 extra]# touch blog.conf

修改每個虛擬主機(jī)的conf目錄

   server {

        listen       80;

        server_name  www.etiantian.org etiantian.org;

        location / {

            root   html/www;

            index  index.html index.htm;

        }

        access_log logs/access_www.log main;

        }

設(shè)置開機(jī)啟動

[root@web02 oldboy]# echo "/application/nginx/sbin/nginx " >>/etc/rc.local 

[root@web02 oldboy]# tail -1 /etc/rc.local

/application/nginx/sbin/nginx 

MySQL搭建命令

安裝MySQL

上傳MySQL  

ls mysql-5.5.49-linux2.6-x86_64.tar.gz 

tar xf mysql-5.5.49-linux2.6-x86_64.tar.gz

mkdir /application -p 

mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49 

ln -s /application/mysql-5.5.49 /application/mysql 

useradd mysql -s /sbin/nologin -M 創(chuàng)建用戶和授權(quán)目錄

chown -R mysql.mysql /application/mysql/ 創(chuàng)建用戶和授權(quán)目錄

cd /application/mysql 

./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/ 初始化時數(shù)據(jù)庫

ll data/

\cp support-files/my-small.cnf  /etc/my.cnf 創(chuàng)建基本需求

cp support-files/mysql.server /etc/init.d/mysqld 創(chuàng)建基本需求

chmod +x /etc/init.d/mysqld  給執(zhí)行權(quán)限

sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld 修改配置文件

/etc/init.d/mysqld start 開啟服務(wù)、

netstat -lntup|grep mysql 檢查

echo "PATH="/application/mysql/bin:$PATH"" >>/etc/profile

chkconfig --add mysqld 開啟服務(wù)

chkconfig mysqld on 開啟服務(wù)

cp -a /application/mysql/bin/* /usr/local/sbin/ 

ln -s /application/mysql/bin/* /usr/local/sbin/

mysql 

1、安裝PHP基礎(chǔ)庫

yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y

yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y

rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

需要先安裝支持的軟件包

cd /home/oldboy/tools 

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make

make install

cd ../

2、PHP相關(guān)擴(kuò)展庫

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum -y install libmcrypt-devel

yum -y install mhash

yum -y install mcrypt

rpm -qa libmcrypt-devel mhash mcrypt

解壓php安裝包,編輯

上傳PHP包

tar xf php-5.5.32.tar.gz 解壓php安裝包

./configure \

--prefix=/application/php5.5.32 \

--with-mysql=/application/mysql/ \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--with-mcrypt \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-soap \

--enable-short-tags \

--enable-static \

--with-xsl \

--with-fpm-user=www \

--with-fpm-group=www \

--enable-ftp \

--enable-opcache=no

ln -s /application/mysql/lib/libmysqlclient.so.18  /usr/lib64/

touch ext/phar/phar.phar

make

make install

ln -s /application/php5.5.32/ /application/php

ls /application/php/

cp php.ini-production /application/php/lib/php.ini

配置php解析文件

cp php.ini-production /application/php/lib/php.ini

配置php-fpm配置文件

cp php-fpm.conf.default php-fpm.conf

啟動php-fpm

/application/php/sbin/php-fpm 

lsof -i :9000

ps -ef|grep php-fpm

root@web01 extra]# cat blog.conf       

    server {

        listen       80;

        server_name  blog.etiantian.org;

        location / {

            root   html/blog;

            index  index.html index.htm;

        }

        location ~ .*\.(php|php5)?$ {

            root html/blog;

            fastcgi_pass  127.0.0.1:9000;

            fastcgi_index index.php;

            include fastcgi.conf;

        }

    }

[root@web01 extra]# ../../sbin/nginx  -t

nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok

nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful

[root@web01 extra]# ../../sbin/nginx  -s reload

[root@web01 blog]# cat test_mysql.php 

        $link_id=mysql_connect('localhost','root','oldboy123') or mysql_error();

        if($link_id){

                echo "mysql successful by oldboy !";

        }else{

                echo mysql_error();

        }

?>

搭建blog命令

mysql -uroot -poldboy123

create database wordpress;

show databases;

grant all on wordpress.* to wordpress@'localhost' identified by '123456';

select user,host from mysql.user;

show grants for wordpress@'localhost';

flush privileges;

下載博客安裝

 wget https://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz

  ll

 tar xf wordpress-4.5.1-zh_CN.tar.gz 

 ls wordpress

 cp -a wordpress/* /application/nginx/html/blog/

 ls /application/nginx/html/blog/

 chown -R www.www /application/nginx/html/blog/

 ls /application/nginx/html/blog/

 ls /application/nginx/html/blog/ -l

 history 

分離命令

wed命令

mysqldump -uroot -poldboy123 wordpress -B |gzip>bak.sql.gz

scp bak.sql.gz  root@10.0.0.51:/tmp

數(shù)據(jù)庫MySQL命令

cd /tmp

gzip xf bak.sql.tar.gz

mysql -uroot -poldboy123 -e "show databases like 'wordpress';"

mysql -uroot -poldboy123 -e "use wordpress;show tables;"

mysql -uroot -poldboy123

grant all on wordpress.* to wordpress@'172.16.1.%' identified by '123456';

flush privileges;

select user,host from mysql.user;

更改.8配置文件 wp-config.php

32 define('DB_HOST', '172.16.1.51');

關(guān)閉本地數(shù)據(jù)庫

/etc/init.d/mysqld stop

chkconfig mysqld off

成功。

2、將blog的資源文件遷移到NFS

[root@web01 blog]# tree wp-content/uploads/

資源目錄為:wp-content/uploads/

nfs命令

echo "/uploads 172.16.1.0/24(rw,sync)" /etc/exports

MySQL數(shù)據(jù)庫命令

mount -t nfs  172.16.1.31:/uploads /application/nginx/html/blog/

根據(jù)老男孩老師的講解,和實(shí)際操作搭建出來


網(wǎng)站名稱:LNMP博客以及數(shù)據(jù)庫分離搭建實(shí)戰(zhàn)
網(wǎng)頁網(wǎng)址:http://weahome.cn/article/ipcegp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部