Centos7 使用WordPress快速搭建个人博客

本文详细介绍了如何在Centos7上快速搭建WordPress个人博客,包括禁用防火墙、安装LAMP环境(Apache+PHP+MySQL)、下载安装WordPress以及解决公网访问异常的问题。通过yum安装Apache、PHP、MariaDB,并创建数据库和用户,最后调整httpd端口以应对未备案情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、系统环境

[root@ecs-35f2 ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[root@ecs-35f2 ~]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether fa:16:3e:49:29:b4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.181/24 brd 192.168.2.255 scope global dynamic eth0
       valid_lft 86260sec preferred_lft 86260sec
    inet6 fe80::f816:3eff:fe49:29b4/64 scope link 
       valid_lft forever preferred_lft forever


 

为了方便测试,停止并且开机不启动防火墙,生产环境根据需要进行调整

[root@ecs-35f2 ~]# systemctl stop firewalld
[root@ecs-35f2 ~]# systemctl disable firewalld

设置selinux=disabled

[root@ecs-35f2 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

二、yum 安装Apache+PHP+MySQL(LAMP)环境,(或者搜索XAMPP集成包直接安装,这里不演示)

1、安装Apache

yum方式安装httpd

[root@ecs-35f2 ~]# yum install httpd -y
[root@ecs-35f2 ~]# rpm -qa | grep httpd
httpd-manual-2.4.6-67.el7.centos.6.noarch
httpd-tools-2.4.6-67.el7.centos.6.x86_64
httpd-2.4.6-67.el7.centos.6.x86_64

启动httpd并设置开机启动

[root@ecs-35f2 ~]# systemctl start httpd.service 
[root@ecs-35f2 ~]# systemctl enable  httpd.service 

使用浏览器打开本地IP查看

2、安装PHP

yum 方式安装php

[root@ecs-35f2 ~]# yum install php php-mysql -y
[root@ecs-35f2 ~]# rpm -qa | grep php
php-cli-5.4.16-43.el7_4.x86_64
php-mysql-5.4.16-43.el7_4.x86_64
php-common-5.4.16-43.el7_4.x86_64
php-5.4.16-43.el7_4.x86_64
php-pdo-5.4.16-43.el7_4.x86_64

在Apache网页目录下创建一个.php结尾的php文件并重启httpd服务,测试能否正常访问

[root@ecs-35f2 ~]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

友人a笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值