Nginx服务LNMP中WordPress部署流程步骤的示例分析
发表于:2025-02-07 作者:千家信息网编辑
千家信息网最后更新 2025年02月07日,这篇文章主要为大家展示了"Nginx服务LNMP中WordPress部署流程步骤的示例分析",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"Nginx服务LN
千家信息网最后更新 2025年02月07日Nginx服务LNMP中WordPress部署流程步骤的示例分析
这篇文章主要为大家展示了"Nginx服务LNMP中WordPress部署流程步骤的示例分析",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"Nginx服务LNMP中WordPress部署流程步骤的示例分析"这篇文章吧。
实验环境
实验环境:
[root@lnmp ~]# uname -r2.6.32-754.el6.x86_64[root@lnmp ~]# cat /etc/redhat-release CentOS release 6.10 (Final)[root@lnmp ~]# cat /etc/hosts192.168.1.30 lnmp172.16.1.30 lnmp
软件版本:
NGINX:nginx-1.12.2.tar.gzMYSQL:mysql-5.6.47-linux-glibc2.12-x86_64.tar.gzPHP:php-5.5.3.tar.gzlibiconv:libiconv-1.16.tar.gzwordpress:wordpress-4.7.3-zh_CN.tar.gz
安装Nginx服务
Nginx服务部署过程:
请参考:小白也可以完成的0基础部署Nginx服务
安装Mysql数据库
下载二进制MySQL包:
[root@lnmp tools]# wget -q https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-5.6/mysql-5.6.47-linux-glibc2.12-x86_64.tar.gz
解压MySQL包:
[root@lnmp tools]# tar xf mysql-5.6.47-linux-glibc2.12-x86_64.tar.gz -C /app/
创建MySQL用户及授权:
[root@lnmp tools]# cd /app/[root@lnmp app]# ln -s mysql-5.6.47-linux-glibc2.12-x86_64/ /app/mysql[root@lnmp tools]# useradd mysql -s /sbin/nologin -M[root@lnmp mysql]# chown mysql.mysql /app/mysql/data/
初始化MySQL:
第一遍初始化报错,然后我把data目录下东西干掉后就好了。什么原理?
[root@lnmp mysql]# bin/mysqld --user=mysql --datadir=/app/mysql/data --basedir=/app/mysql
制作MySQL启动脚本:
[root@lnmp data]# cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld cp:是否覆盖"/etc/init.d/mysqld"? y[root@lnmp mysql]# sed -ri 's#/usr/local#/app#g' /etc/init.d/mysqld /app/mysql/bin/mysqld_safe
创建配置文件:
[root@lnmp mysql]# cp /app/mysql/support-files/my-default.cnf /etc/my.cnf cp:是否覆盖"/etc/my.cnf"? y
启动MySQL:
[root@lnmp mysql]# /etc/init.d/mysqld restartShutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS! [root@lnmp mysql]# netstat -utpln | grep mysqldtcp 0 0 :::3306 :::* LISTEN 17796/mysqld
设置环境变量:
[root@lnmp mysql]# echo 'export PATH=/app/mysql/bin:$PATH' >>/etc/profile[root@lnmp mysql]# source /etc/profile
登录数据库:
因为初始密码为空,所以登录后要修改密码
[root@lnmp mysql]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> [root@lnmp mysql]# mysqladmin -u root password '123123'Warning: Using a password on the command line interface can be insecure.[root@lnmp mysql]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
安装PHP
下载PHP包及liblconv包:
[root@lnmp ~]# cd /server/tools/[root@lnmp tools]# wget https://museum.php.net/php5/php-5.5.3.tar.gz[root@lnmp tools]# wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
安装依赖包:
[root@lnmp tools]# yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel[root@lnmp tools]# yum -y install libiconv-devel freetype-devel libpng-devel gd-devel[root@lnmp tools]# yum -y install libcurl-devel libxslt-devel[root@lnmp tools]# yum -y install libmcrypt-devel mhash mcrypt
编译安装语言转换工具:
[root@lnmp tools]# tar xf libiconv-1.16.tar.gz [root@lnmp tools]# cd libiconv-1.16[root@lnmp libiconv-1.16]# ./configure --prefix=/usr/local/libiconv[root@lnmp libiconv-1.16]# make && make install
解压PHP包进行预编译:
[root@lnmp libiconv-1.16]# cd /server/tools/[root@lnmp tools]# tar xf php-5.5.3.tar.gz [root@lnmp tools]# cd php-5.5.3[root@lnmp php-5.5.3]# mkdir -p /app/php-5.5.3[root@lnmp php-5.5.3]# ./configure --prefix=/app/php-5.5.3 --with-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[root@lnmp php-5.5.3]# echo $?0
防报错处理:
[root@lnmp php-5.5.3]# ln -s /app/mysql/lib/libmysqlclient.so.18 /usr/lib64/[root@lnmp php-5.5.3]# touch ext/phar/phar.phar
编译安装PHP:
[root@lnmp php-5.5.3]# make && make install[root@lnmp php-5.5.3]# echo $?0[root@lnmp php-5.5.3]# cp php.ini-production /app/php-5.5.3/lib/[root@lnmp php-5.5.3]# ln -s /app/php-5.5.3/ /app/php[root@lnmp php-5.5.3]# cd /app/php/etc/[root@lnmp etc]# ll总用量 28-rw-r--r-- 1 root root 1152 8月 25 06:39 pear.conf-rw-r--r-- 1 root root 21846 8月 25 06:39 php-fpm.conf.default[root@lnmp etc]# cp php-fpm.conf.default php-fpm.conf[root@lnmp etc]# vim php-fpm.conflisten = 172.16.1.30:9000
启动PHP:
[root@lnmp etc]# useradd -s /sbin/nologin -M www[root@lnmp etc]# /app/php/sbin/php-fpm[root@lnmp etc]# netstat -utpln | grep phptcp 0 0 172.16.1.30:9000 0.0.0.0:* LISTEN 39741/php-fpm
修改Nginx配置文件
[root@lnmp etc]# cd /app/nginx/conf/[root@lnmp conf]# cp nginx.conf nginx.conf.bak[root@lnmp conf]# grep -Ev "#|^$" nginx.conf.default >nginx.conf[root@lnmp conf]# vim nginx.conf[root@lnmp conf]# cat nginx.confworker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 192.168.1.30; location / { root html/www; index index.html index.htm index.php; location ~* .*\.(php|php5)?$ { fastcgi_pass 172.16.1.30:9000; fastcgi_index index.php; include fastcgi.conf; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }}[root@lnmp conf]# /app/nginx/sbin/nginx -tnginx: the configuration file /app/nginx-1.12.2//conf/nginx.conf syntax is oknginx: configuration file /app/nginx-1.12.2//conf/nginx.conf test is successful
重新启动Nginx服务:
[root@lnmp etc]# /app/nginx/sbin/nginx -s reload
测试:
[root@lnmp etc]# cd /app/nginx/html/[root@lnmp html]# ls50x.html index.html[root@lnmp html]# vim test_php.php[root@lnmp html]# cat test_php.php 网页访问:192.168.1.30/test_php.php出现php页面,代表正常
部署WordPress个人博客
下载安装包:
[root@lnmp tools]# wget https://cn.wordpress.org/wordpress-4.7.3-zh_CN.tar.gz[root@lnmp tools]# tar xf wordpress-4.7.3-zh_CN.tar.gz
部署站点:
[root@lnmp tools]# mkdir -p /app/nginx/html/www[root@lnmp tools]# mv wordpress/* /app/nginx/html/www[root@lnmp tools]# chown -R www.www /app/nginx/html/www/
创建数据库信息:
[root@lnmp tools]# mysql -uroot -p123123mysql> create database wordpress;Query OK, 1 row affected (0.01 sec)mysql> grant all on wordpress.* to 'wordpress'@'localhost' identified by '123123';Query OK, 0 rows affected (0.04 sec)
登录网站配置网站:
http://ip/wp-admin
主机默认localhost。截错了
以上是"Nginx服务LNMP中WordPress部署流程步骤的示例分析"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
服务
步骤
流程
示例
分析
内容
数据
数据库
环境
篇文章
登录
编译
配置
密码
文件
网站
学习
实验
帮助
东西
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
数据库用什么存储模型
吉林推广软件开发条件
浪潮服务器通电开机
傲视千雄 服务器端
互联网消费科技
租用游戏服务器
服务器网盘容量不一样可以吗
软件开发工程师证书重要吗
超微服务器默认管理口ip
天目小说软件开发
网络安全分析师考试
焦点科技互联网金融
边缘服务器的计算能力大小
app软件开发哪个产品好
网络正常却显示服务器未响应
网络安全公司排名
蒋胜山计算机网络安全
交换机和服务器连接
海南金财网络技术有限公司 预算
服务器主机一般多少内存
高校网络安全专题会议纪要范文
h2数据库表导出
南粤分享汇互联网科技有限公司
南京网络安全的公司
中国工商软件开发中心成都
计算机网络技术笔记软件手机
博山物流竞价报价软件开发
智联睿通网络技术服务有限公司
网络技术证书所需材料
有哪些眼镜行业软件开发