当前位置: 首页 > news >正文

LAMP+WordPress

一、简介

LAMP:
  • L:linux——操作系统,提供服务器运行的基础环境。
  • A:apache(httpd)——网页服务器软件,负责处理HTTP请求和提供网页内容。
  • M:mysql,mariadb——数据库管理系统,用于存储网站数据。
  • P:php,perl,python——服务器端脚本语言,用于生成动态网页内容。
LAMP的特点包括:
  • 开源:所有组件都是开源的,这意味着它们可以免费使用,并且有活跃的社区支持。
  • 灵活性:LAMP组件可以灵活配置,以适应不同的网站需求。
  • 广泛支持:由于其流行度,有大量的教程、文档和工具来支持LAMP环境。
  • 稳定性:Linux和Apache都是经过长期测试的稳定系统。
  • 安全性:虽然任何系统都可能面临安全威胁,但LAMP组件有定期的安全更新和补丁。
WordPress:

WordPress是一个开源的内容管理系统,最初于2003年被开发用来简化个人在线写作,但随着时间的发展,它已经成长为一个全功能的网站框架。WordPress使用PHP编写,使用MySQL作为数据库管理系统。

WordPress的特点包括:
  • 易用性:WordPress有一个直观的后台管理界面,使得即使是非技术用户也能轻松管理网站。
  • 可扩展性:通过插件和主题,WordPress可以扩展其功能,适应各种网站需求。
  • 社区支持:有一个庞大的社区,提供帮助、教程和资源。
  • SEO友好:WordPress支持搜索引擎优化(SEO),有助于提高网站在搜索引擎中的排名。
  • 多语言支持:WordPress支持多种语言,可以创建多语言网站。
  • 移动友好:WordPress主题和插件支持响应式设计,确保网站在各种设备上都能良好显示。

LAMP和WordPress经常一起使用,因为WordPress可以在LAMP环境中运行,利用Apache作为服务器,MySQL作为数据库,PHP作为脚本语言。这种组合提供了一个强大而灵活的平台,用于构建和维护网站。 

二、搭建

下载需要的软件包,启动数据库和httpd
[root@node1 ~]# yum -y mariadb mariadb-server httpd
[root@node1 ~]# systemctl restart mariadb
[root@node1 ~]# systemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@node1 ~]#
配置数据库,初始化数据库
[root@node1 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] 
Enabled successfully!
Reloading privilege tables..... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y     # 设置数据库的root密码
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y       # 移除匿名... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n      # 远程连接... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y   # 是否删除原来的默认表- Dropping test database...... Success!- Removing privileges on test database...... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y      # 是否同步初始化... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
[root@node1 ~]#
安装php,配置php文件,设置php的时区并启动php
[root@node1 ~]# yum -y install php php-cli php-fpm php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd[root@node1 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai[root@node1 ~]# systemctl enable php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@node1 ~]# 
为php做一个网页
[root@node1 ~]# cd /var/www/html/
[root@node1 html]# vim index.php
[root@node1 html]# cat index.php 
<?phpphpinfo
?>
[root@node1 html]#
更改apache的配置文件,是其支持php的网页
[root@node1 ~]# vim /etc/httpd/conf/httpd.conf
<IfModule dir_module>DirectoryIndex index.html index.php
</IfModule>
浏览器访问ip查看网页,看到默认的网页

192.168.100.10

基本架构已经做好

基于此架构部署wordpress

准备好wordpress安装包,解压
[root@node1 ~]# mkdir /etc/software
[root@node1 ~]# cd /etc/software#上传安装包
[root@node1 software]# ls
wordpress  wordpress-6.5.5.tar.gz[root@node1 software]# cp -r wordpress /var/www/html/     # 移动到默认网页下面
[root@node1 software]# ls /var/www/html/
index.php  wordpress
[root@node1 software]#
更改wordpress的所属主所属组,更改权限为775
[root@node1 html]# cd /var/www/html/
[root@node1 html]# ll -ld wordpress/
drwxr-xr-x 5 root root 4096 Jul 16 09:47 wordpress/
[root@node1 html]# chown -R apache.apache /var/www/html/wordpress/[root@node1 html]# ll -ld wordpress/
drwxr-xr-x 5 apache apache 4096 Jul 16 09:47 wordpress/
[root@node1 html]# chmod -R 775 /var/www/html/wordpress/
[root@node1 html]# ll -ld wordpress/
drwxrwxr-x 5 apache apache 4096 Jul 16 09:47 wordpress/
为数据库做配置
[root@node1 html]# mysql -u root -p        # 登录数据库
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.5.22-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database sjk_db;        # 创建数据表
Query OK, 1 row affected (0.000 sec)MariaDB [(none)]> create user 'wordpress_user'@'localhost' identified by 'linux'  # 设置用户名和密码-> ;
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> grant all on sjk_db.* to 'wordpress_user'@'localhost'    # 为用户设置权限-> ;
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> flush privileges;     # 同步设置
Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]>
使用虚拟主机来配置apache,更改配置文件
[root@node1 html]# cp -r /usr/share/doc/httpd-core/httpd-vhosts.conf /etc/httpd/conf.d
[root@node1 html]# vim /etc/httpd/conf.d/httpd-vhosts.conf 
<VirtualHost 192.168.100.10:80>DocumentRoot "/var/www/html/wordpress"<Directory "/var/www/html/wordpress">Options Indexes FollowSymLinksAllowOverride allRequire all granted</Directory>
配置好配置文件后启动httpd,访问ip查看网页内容

192.168.100.10

登录

完成!

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 15、Python如何获取文件的状态
  • 测试工具笔记
  • 2024.9.15周报
  • ThinkPHP8出租屋管理系统
  • 2011年全国硕士研究生入学统一考试计算机科学与技术
  • 2024_中秋国庆双节来临 祝CSDN所有开发者与网站节日快乐
  • 详解 Pandas 的 rename 函数
  • Linux PTP 测量实操 (IEEE 1588)
  • vscode 链接数据库
  • RLS带遗忘因子的递归最小二乘法
  • SSH软链接后门从入门到应急响应
  • AI创意引擎:优化Prompt提示词的高效提问技巧
  • 《深度学习》OpenCV 高阶 图像金字塔 用法解析及案例实现
  • Linux学习-ELK(一)
  • 线性代数 第六讲 特征值和特征向量_相似对角化_实对称矩阵_重点题型总结详细解析
  • 【node学习】协程
  • 【RocksDB】TransactionDB源码分析
  • 【干货分享】SpringCloud微服务架构分布式组件如何共享session对象
  • Android优雅地处理按钮重复点击
  • Java Agent 学习笔记
  • js ES6 求数组的交集,并集,还有差集
  • k个最大的数及变种小结
  • react-core-image-upload 一款轻量级图片上传裁剪插件
  • react-native 安卓真机环境搭建
  • Vue ES6 Jade Scss Webpack Gulp
  • Vue2 SSR 的优化之旅
  • 产品三维模型在线预览
  • 创建一种深思熟虑的文化
  • 从零开始在ubuntu上搭建node开发环境
  • 欢迎参加第二届中国游戏开发者大会
  • 浅谈web中前端模板引擎的使用
  • 如何使用 OAuth 2.0 将 LinkedIn 集成入 iOS 应用
  • 什么软件可以剪辑音乐?
  • 数组大概知多少
  • 在Unity中实现一个简单的消息管理器
  • postgresql行列转换函数
  • ​queue --- 一个同步的队列类​
  • #if #elif #endif
  • #Js篇:单线程模式同步任务异步任务任务队列事件循环setTimeout() setInterval()
  • (01)ORB-SLAM2源码无死角解析-(56) 闭环线程→计算Sim3:理论推导(1)求解s,t
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (SpringBoot)第七章:SpringBoot日志文件
  • (附源码)spring boot车辆管理系统 毕业设计 031034
  • (附源码)springboot码头作业管理系统 毕业设计 341654
  • (附源码)springboot人体健康检测微信小程序 毕业设计 012142
  • (附源码)springboot掌上博客系统 毕业设计063131
  • (附源码)ssm跨平台教学系统 毕业设计 280843
  • (更新)A股上市公司华证ESG评级得分稳健性校验ESG得分年均值中位数(2009-2023年.12)
  • (贪心) LeetCode 45. 跳跃游戏 II
  • (译)计算距离、方位和更多经纬度之间的点
  • (转)Sublime Text3配置Lua运行环境
  • **PHP二维数组遍历时同时赋值
  • .NET 4 并行(多核)“.NET研究”编程系列之二 从Task开始
  • .NET Core/Framework 创建委托以大幅度提高反射调用的性能
  • .NET 依赖注入和配置系统