在服务器上搭建多个WordPress博客网站教程(超级详细)

news/2024/5/10 0:28:31/文章来源:https://blog.csdn.net/weixin_34283445/article/details/92727849

实验准备

一台阿里云服务器
二个域名(IP与域名已经建立解析关系)
Linux关于web架构的知识

实验步骤

1.用crt远程登录阿里云服务器

在服务器上搭建多个WordPress博客网站教程(超级详细)

2.安装nginx,mysql,php

建议使用lnmp一键安装包安装,方便快捷

获取lnmp一键安装包链接

lnpm官网链接

找到下载页面选择最新的复制其链接。

写此文时最新版本信息如下:

LNMP 1.4 测试版
http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz  (131KB)

安装 163源

[root@linfan ~]# cd /etc/yum.repos.d/
[root@linfan yum.repos.d]# mv * /tmp/
[root@linfan yum.repos.d]# curl -o 163.repo   http://mirrors.163.com/.help/CentOS7-Base-163.repo% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100  1572  100  1572    0     0  13343      0 --:--:-- --:--:-- --:--:-- 13435
[root@linfan yum.repos.d]# sed -i 's/\$releasever/7/g' 163.repo
[root@linfan yum.repos.d]# sed -i 's/^enabled=.*/enabled=1/g' 163.repo
[root@linfan yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base centosplus extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
[root@linfan yum.repos.d]# yum -y install epel-release
Loaded plugins: fastestmirror
base                                                                                               | 3.6 kB  00:00:00
centosplus                                                                                         | 3.4 kB  00:00:00
extras                                                                                             | 3.4 kB  00:00:00
updates                                                                                            | 3.4 kB  00:00:00
(1/5): base/x86_64/group_gz                                                                        | 166 kB  00:00:00
(2/5): extras/x86_64/primary_db                                                                    | 187 kB  00:00:00
(3/5): centosplus/x86_64/primary_db                                                                | 2.9 MB  00:00:01
(4/5): updates/x86_64/primary_db                                                                   | 5.2 MB  00:00:02
(5/5): base/x86_64/primary_db                                                                      | 5.9 MB  00:00:02
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================Package                          Arch                       Version                     Repository                  Size
==========================================================================================================================
Installing:epel-release                     noarch                     7-11                        extras                      15 kTransaction Summary
==========================================================================================================================
Install  1 PackageTotal download size: 15 k
Installed size: 24 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for epel-release-7-11.noarch.rpm is not installed
epel-release-7-11.noarch.rpm                                                                       |  15 kB  00:00:00
Retrieving key from http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5From       : http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : epel-release-7-11.noarch                                                                               1/1Verifying  : epel-release-7-11.noarch                                                                               1/1Installed:epel-release.noarch 0:7-11Complete!
[root@linfan ~]# yum -y install wget 

上传脚本并执行

// 脚本执行过程中 有需要选择的直接敲回车键即可 有选择版本的需要根据自己的需求来选择即可
[root@linfan ~]# wget http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz [root@linfan ~]# tar -zxvf lnmp1.4beta.tar.gz 
[root@linfan ~]# cd lnmp1.4
[root@linfan lnmp1.4]# ./install.sh   +------------------------------------------------------------------------+
|          LNMP V1.4 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|        A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux       |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.56 (Default)
3: Install MySQL 5.6.36
4: Install MySQL 5.7.18
5: Install MariaDB 5.5.56
6: Install MariaDB 10.0.30
7: Install MariaDB 10.1.23
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0):  
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0):
No input,You will install MySQL 5.5.56
===========================
Please setup root password of MySQL.(Default password: root)
Please enter:
MySQL root password: root
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]:
No input,The InnoDB Storage Engine will enable.
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38 (Default)
5: Install PHP 5.6.31
6: Install PHP 7.0.21
7: Install PHP 7.1.7
Enter your choice (1, 2, 3, 4, 5, 6 or 7):
No input,You will install PHP 5.5.38
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3):  
No input,You will not install Memory Allocator.Press any key to install...or Press Ctrl+c to cancel 
//后续执行的过程有些漫长大概三十到四十分钟左右,可以先看看电视听听音乐放松下 哈哈

看到这个界面说明脚本执行成功了
在服务器上搭建多个WordPress博客网站教程(超级详细)

简单说明一下,此安装过程安装完成便也启动了nginx,mysql,php-fpm并加入了开机启动项。如果重启服务器,不需要再单独手动开启相关的服务了。总的来说相当方便的。

此时 在浏览器输入IP即可访问到如下页面

在服务器上搭建多个WordPress博客网站教程(超级详细)

网站根目录路径/home/wwwroot/default,如果只用来放一些静态页面,那么,现在就足够了,直接将你的html,js,css等文件丢进去即可。

退出使用ctrl+c

IP与网站的映射关系

 [root@linfan ~]# vi /usr/local/nginx/conf/nginx.conf......server{listen 80 default_server;#listen [::]:80 default_server ipv6only=on;server_name lin.kjsc366.com; //编辑此处index index.html index.htm index.php;root  /home/wwwroot/default;

检测nginx配置文件语法并重新加载nginx

[root@linfan ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@linfan ~]# nginx -s reload

安装WordPress

中文官方站点 英文官方站点具体的根据自己的需求选择。下面以中文版为例。当前最新版本是4.7.2

为了方便,我们还是在用站点默认的路径

[root@linfan ~]# cd /home/wwwroot/  //进入网站根目录上一级目录
[root@linfan wwwroot]# mv default old  //将default重命名为old
[root@linfan wwwroot]# wget https://cn.wordpress.org/wordpress-4.7.2-zh_CN.tar.gz  //下载WordPress包中文版
[root@linfan wwwroot]# tar -zxvf wordpress-4.7.2-zh_CN.tar.gz  //解压WordPress包
[root@linfan wwwroot]# ls
old  wordpress  wordpress-4.7.2-zh_CN.tar.gz
[root@linfan wwwroot]# mv wordpress default  //将wordpress重命名为default
[root@linfan wwwroot]# ls
default  old  wordpress-4.7.2-zh_CN.tar.gz 

给予相应权限

[root@linfan default]# chown -R 755 /home/wwwroot //目录以及目录下的文件授权
chown: changing ownership of ‘/home/wwwroot/old/.user.ini’: Operation not permitted
[root@linfan default]#  chown -R www:www /home/wwwroot/ //将目录的所有者分给www组下的www用户。
chown: changing ownership of ‘/home/wwwroot/old/.user.ini’: Operation not permitted

出现的提示大概是说有一个文件无法更改用户分组和权限。不会影响你的wordpress,忽略就好

创建一个数据库wordpress

[root@linfan default]# mysql -u root -p
Enter password:  密码默认是root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 24
Server version: 5.5.56-log Source distributionCopyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| wordpress          |
+--------------------+
4 rows in set (0.00 sec)mysql> quit  

配置WordPress

在浏览器输入域名地址进行访问

在服务器上搭建多个WordPress博客网站教程(超级详细)

点击现在就开始。这时候我们看到如下页面:

在服务器上搭建多个WordPress博客网站教程(超级详细)

按照之前设置的,输入如下信息:

数据库名:wordpress
用户名:root
密码:root
数据库主机:localhost
表前缀:wp_

点击提交
在服务器上搭建多个WordPress博客网站教程(超级详细)
到这一步,基本上就意味着大功告成了,因为后边基本不会出错啦。

点击进行安装按钮。出现下图:
在服务器上搭建多个WordPress博客网站教程(超级详细)
按照自己的需求填写,比如我这里填写如下:
在服务器上搭建多个WordPress博客网站教程(超级详细)
点击安装WordPress按钮,然后登录设置啥的纯页面操作就不在这里过多介绍

在服务器上搭建多个WordPress博客网站教程(超级详细)

再建一个WordPress

在网站根网页目录下创建一个新的目录/home/wwwroot/default/doudou

[root@linfan wwwroot]# tar xf wordpress-4.7.2-zh_CN.tar.gz
[root@linfan wwwroot]# ls
default  old  wordpress  wordpress-4.7.2-zh_CN.tar.gz
[root@linfan wwwroot]# mv wordpress default/doudou
[root@linfan wwwroot]# cd default/doudou
[root@linfan doudou]# ls
index.php    wp-activate.php     wp-comments-post.php  wp-cron.php        wp-load.php   wp-settings.php   xmlrpc.php
license.txt  wp-admin            wp-config-sample.php  wp-includes        wp-login.php  wp-signup.php
readme.html  wp-blog-header.php  wp-content            wp-links-opml.php  wp-mail.php   wp-trackback.php

复制配置文件里面的server内容 在后面添加复制的内容

[root@linfan ~]# vi /usr/local/nginx/conf/nginx.conf
...
...server{listen 80 default_server;#listen [::]:80 default_server ipv6only=on;server_name fan.kjsc366.com; //编辑此处index index.html index.htm index.php;root  /home/wwwroot/default/doudou; //编辑此处添加上一步创建的目录doudou#error_page   404   /404.html;# Deny access to PHP files in specific directory#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }include enable-php.conf;location /nginx_status{stub_status on;access_log   off;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)${expires      30d; location ~ .*\.(js|css)?${expires      12h;}location ~ /.well-known {allow all;}location ~ /\.{deny all;}access_log  /home/wwwlogs/access.log;}   include vhost/*.conf; }    

新建一个同名的vhost/doudou.confinclude vhost/*.conf建立对应关系

[root@linfan ~]mkdir -p /vhost/doudou.conf

再建立一个数据库doudou

[root@linfan ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.56-log Source distributionCopyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database doudou;
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| doudou             |
| mysql              |
| performance_schema |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)mysql> quit
Bye

输入fan.kjsc366.com

在服务器上搭建多个WordPress博客网站教程(超级详细)

重新出来一个wordpress页面
在服务器上搭建多个WordPress博客网站教程(超级详细)

此时 我使用新建的数据库doudou 进行配置WordPress

上面有详细配置过程,在此不再赘述

我们来直接看效果:
输入域名lin.kjsc366.com 效果如下:
在服务器上搭建多个WordPress博客网站教程(超级详细)

输入域名fan.kjsc366.com 效果如下
在服务器上搭建多个WordPress博客网站教程(超级详细)

PS:

后期如果需要配置WordPress 则需要在浏览器输入域名/wp-admin/setup-config.php
例如我的是

lin.kjsc366.com/wp-admin/setup-config.php

后期问题解决

有问题的反馈在此,我会进行补充。

转载于:https://blog.51cto.com/13858192/2169046

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_823966.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网站建设指南之网站HTTPS化与证书

通常我们说的HTTPS就是HTTPSSL证书&#xff0c;简单的说就是HTTP的安全版。HTTP网站的数据传输都是以明文形式&#xff0c;比如用户密码等信息都没有加密&#xff0c;很容易造成信息泄露。绑定SSL证书后&#xff0c;可以实现网站HTTPS化&#xff0c;加密用户与网站之间的交互访…

bae部署php网站,thinkphp部署bae的相关配置

thinkphp3.2.3发布到bae3.0&#xff0c;在tp的config.php中设置URL_MODEL1&#xff0c;入口文件index.php中设置define(BIND_MODULE,Home);// 绑定Home模块到当前入口文件define(BIND_CONTROLLER,Index);// 绑定Index控制器到当前入口文件这样在xampp中调试可以直接是localhost…

linux新加网站,linux云主机如何添加网站?

如何在云主机上添加网站?云主机也是有不同的操作系统区分的&#xff0c;比如Windows跟Linux等等&#xff0c;这两种是比较多人选择的云服务器系统。那么&#xff0c;今天万变云给大家带来在linux云主机上进行网站添加的教程。以下配置的路径以网站云提供的标准环境路径为准&am…

html网站栏目列表,栏目列表页.html

&#xfeff;栏目列表页$axure.utils.getTransparentGifPath function() { return resources/images/transparent.gif; };$axure.utils.getOtherPath function() { return resources/Other.html; };$axure.utils.getReloadPath function() { return resources/reload.html; …

网站防御cdn和高防服务器,高防服务器和CDN防御的区别在哪

网络服务器配备纯SSD架构打造的高性能存储&#xff0c;旨在为用户提供优质、高效、弹性伸缩的云计算服务,下面小编给大家介绍一下高防服务器的种类。CDN是网站加速&#xff0c;可以服务器负载能力过低&#xff0c;带宽过少等带来的网站打开速度慢等问题。一个网站的服务器性能比…

Linux系统使用Gogs搭建私服Git网站

文章目录1. 安装Docker2. 安装Gogs3. 配置Git仓库系统&#xff1a;CentOS 7.4 64位1. 安装Docker # 通过yum源安装docker yum -y install docker # 启动docker systemctl start docker # 开机自启 sudo systemctl enable docker2. 安装Gogs 下载Gogs镜像 docker pull gogs/g…

基于django的视频点播网站开发-step3-注册登录功能

用户注册登录是一个网站的基本功能&#xff0c;django对这部分进行了很好的封装&#xff0c;我们只需要在django的基础上做些简单的修改就可以达到我们想要的效果。在本讲中&#xff0c;我们会用到user中的用户授权方面的一些函数&#xff0c;还会对django中的user进行扩展&…

揭秘全球最大网站Facebook背后的那些软件

Facebook级别规模的挑战   在我们深入细节之前&#xff0c;先了解一组Facebook不得不面对数据&#xff0c;你就可以想象这种规模。 Facebook每月的PV量&#xff1a;630,000,000,000 &#xff08;6千3百亿&#xff09;Facebook上的图片数量超过其他图片网站的总和&#xff08…

使用VS2012开发的网站或者webservice在IIS6.0上发布的注意事项

由于新版的VS2012的出现&#xff0c;很多人转而使用VS2012作为开发工具&#xff0c;微软每次新的版本都会新增一些功能&#xff0c;带给我们不少的惊喜&#xff0c;但是在VS2012或者VS2010下开发的网站或者webservice在部署时要注意了&#xff0c;由于VS2010以上版本的.net fra…

网站导航颜色停留_【设计师必看】提高网站易访问性的5个UI设计技巧

以下内容由摹客团队翻译整理&#xff0c;仅供学习交流。生活中难免会有这样的场景&#xff0c;例如打电话告诉别人你开会快要迟到了。这听起来是一个很简单的操作&#xff0c;对吗? 我也这么认为。但随即我又思考到另外一个问题&#xff0c;当手中有一堆重物时又该如何进行操作…

最简单的小说网站的部署

1.首先准备&#xff1a; 一个公网ip&#xff0c;一台云服务器 2.用ssh连接云服务器 3.rm -rf /etc/yum.repos.d/*.repo 清除损坏的repo包 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-7.repo 下载华为的yum yum cl…

网站文件放在linux的哪个目录中,linux 的命令放在哪个目录下

满意答案yuemeiren682017.05.16采纳率&#xff1a;59% 等级&#xff1a;12已帮助&#xff1a;10073人cd的基本语法是:cd[选项][参数]选项&#xff1a;-P,如果目录是符号链接&#xff0c;则进入实际的目录&#xff1b;-L&#xff0c;如果目录是符号链接&#xff0c;则进行链接…

刚新建好的动态网站项目,创建jsp页面就报错

拿到刚刚可以运行的Eclipse&#xff0c;就马上想敲码了&#xff0c;但一创建项目之后再创建jsp页面就报错 &#xff01; 报错的内容大概为缺乏对应的jar包。我们常用Tomcat为中间体&#xff0c;而他本身是带有开发jsp网站的对应的jar包&#xff0c;检查在创建的时候是否有在Ecl…

想学网站建设与设计的书籍_楚雄网站建设_做网站_网站设计

介绍一诺建站公司成立于2006年&#xff0c;主要提供楚雄网络基础服务和网络推广服务。服务项目包含&#xff1a;楚雄网站建设&#xff0c;手机网站建设&#xff0c;楚雄网站制作&#xff0c;楚雄网站优化&#xff0c;楚雄网站改版&#xff0c;网站SEO优化推广等网络相关服务。我…

页面加载多久算超时_打开一个网站,花几秒钟算正常?

全文共4167字&#xff0c;预计学习时长11分钟图源&#xff1a;turnkeyInternet查询谷歌会发现很多文章指出2到5秒钟网页就能加载完毕。但是&#xff0c;是什么使2-5秒成为预设范围呢&#xff1f;直觉告诉你&#xff0c;答案必定比这更复杂。没错&#xff0c;真正的答案比任何试…

网站正在建设中_网站建设中更有利SEO优化的细节

点击蓝字获取更多优惠信息我们现在日常在网络上所花费的时间超出三分之一&#xff0c;甚至更高。在信息化成型的时代&#xff0c;如果在信息市场中不掉队呢&#xff1f;企业推广外宣的途径和方式有了许多选择&#xff0c;企业网站建设、小程序应用、各网络平台推送&#xff0c;…

C# WPF Image如何利用IsMouseOver变成不同的图片

参考代码&#xff1a; <Image Cursor"Hand" x:Name"testImage" Height"200" Width"200" Stretch"Uniform" MouseEnter"Image_MouseEnter" MouseLeave"Image_MouseLeave"><Image.Style>&l…

wos 文献被引_有哪些免费查找、下载文献的网站?(内含SCI-hub最新地址)

各位小伙伴&#xff0c;好久没有送福利给大家了&#xff0c;今天又要送给大家一份免费课程了&#xff01;&#xff0c;有没有开始激动了&#xff1f;科研文献浩如烟海&#xff0c;如何才能找到对自己有重要参考意义的文献&#xff0c;是每个科研工作者都必须要面对的课题&#…

飞鱼星路由器如何限制外网访问服务器网站,飞鱼星路由器如何限制禁止指定IP上网...

你知道飞鱼星路由器如何限制禁止指定IP上网吗?下面是学习啦小编整理的一些关于飞鱼星路由器如何限制禁止指定IP上网的相关资料&#xff0c;供你参考。飞鱼星路由器限制禁止指定IP上网的方法&#xff1a;如何设置让有的电脑能上网而有的电脑不能上网&#xff0c;这个是一个常见…

vue cli中使用预渲染技术解决SEO对SPA不友好问题

单页面应用(SPA)对于SEO不友好的问题可以通过预渲染(Prerender)和服务端渲染(SSR)技术解决 本文主要记录预渲染技术在vue cli构建的项目中的使用 用到插件prerender-spa-plugin、vue-meta-info 内容1. 引入依赖 prerender-spa-plugin2. vue.config.js配置3. 在main.js 添加监听…