当前位置:首页 > CN2资讯 > 正文内容

centos服务器启用显卡 centos做服务器

11小时前CN2资讯


WordPress 是世界上使用最广泛的博客系统之一,是一款开源的PHP软件。有丰富的插件模板资源,使用WordPress可以快速搭建独立的博客网站。

本教程软件环境基于CentOS 6.8 64位,从配置LNMP环境开始一步步搭建属于你自己的WordPress博客网站。


文章目录

  • 一. 配置LNMP环境
  • 1. 安装Nginx
  • 2.修改Nginx默认配置:
  • 3.安装MySQL
  • 4.安装PHP
  • 二、安装配置WordPress
  • 1.安装WordPress
  • 2.配置数据库
  • 3. 配置Nginx


一. 配置LNMP环境

LNMP是Linux、Nginx、MySQL和PHP的缩写,是WordPress博客系统依赖的基础环境,我们首先需要准备LNMP环境。

1. 安装Nginx

使用yum安装Nginx:

yum install nginx -y
2.修改Nginx默认配置:

去除对IPv6的监听,因为CentOS 6不支持IPv6,需要取消对IPv6地址的监听,否则Nginx不能成功启动。

a) 创建default.conf配置文件

touch /etc/nginx/conf.d/default.conf

b) 编辑配置文件

vi /etc/nginx/conf.d/default.conf

c) 配置文件示例代码

server { listen 80 default_server; # listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }

d) 修改完成后启动Nginx

nginx

e) 这篇教程中我的IP地址为114.115.162.204,浏览器访问该IP地址,查看服务器Nginx是否安装成功,

如果显示以上界面即表示Nginx已经安装成功。
f) 将Nginx设为开机自动启动:

chkconfig nginx on
3.安装MySQL

a) 使用yum安装MySQL:

yum install mysql-server -y

b) 安装完成后,启动MySQL服务:

service mysqld restart

c) 设置MySQL账户root的密码:

我们这里设置root账户的密码为’abc12345678‘,你可以设置其它密码,但需要把这里的密码记住,后面的步骤还需要使用。

/usr/bin/mysqladmin -u root password 'abc12345678'

d) 将MySQL设置为开机自动启动

chkconfig mysqld on
4.安装PHP

a) 使用yum安装PHP:

yum install php-fpm php-mysql -y

b)安装完成后,启动PHP-FPM进程:

service php-fpm start

c) 查看php-fpm进程监听那个端口

netstat -nlpt | grep php-fpm

php-fpm默认监听9000端口


d) 将PHP-FPM设为开机自启动:

chkconfig php-fpm on

以上我们的LNMP环境就配置好了!

二、安装配置WordPress

1.安装WordPress

配置好LNMP环境后,使用yum安装WordPress

yum install wordpress -y

安装完成后,在目录\usr\share\wordpress目录下能看到WordPress的源码

2.配置数据库

a) 进入MySQL

mysql -uroot --password='abc12345678'

此时会进去MySQL编辑界面
b)为WordPress创建一个数据库

CREATE DATABASE wordpress;

c) 创建数据库完成,退出MySQL环境

exit

d) 把数据库配置同步到WordPress配置文件中:
编辑WordPress配置文件:

vi /etc/wordpress/wp-config.php

按i进入编辑模式
参考配置文件如下:

<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', 'abc12345678'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * See http://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7 */ /* Disable all file change, as RPM base installation are read-only */ define('DISALLOW_FILE_MODS', true); /* Disable automatic updater, in case you want to allow above FILE_MODS for plugins, themes, ... */ define('AUTOMATIC_UPDATER_DISABLED', true); /* Core update is always disabled, WP_AUTO_UPDATE_CORE value is ignore */ /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the Codex. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ define('WP_DEBUG', false); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', '/usr/share/wordpress'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
3. 配置Nginx

WordPress已经安装好了,这时我们配置Nginx,把请求转发给PHP-FPM来处理
a) 备份Nginx默认配置文件

cd /etc/nginx/conf.d/ mv default.conf default.conf.bak

b) 在Nginx配置文件中创建WordPress配置文件wordpress.conf

touch /etc/nginx/conf.d/wordpress.conf vi /etc/nginx/conf.d/wordpress.conf

示例代码:

server { listen 80; root /usr/share/wordpress; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php index.php; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }

c) 配置成功后,重新加载nginx

nginx -s reload

d)浏览器打开相应IP查看是否成功

定义好站点名、管理员用户名和密码后,浏览器中再次打开该IP地址

这样,你的WordPress就搭建成功啦~


    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/23641.html

    分享给朋友:

    “centos服务器启用显卡 centos做服务器” 的相关文章

    深入解析APT攻击及其主要案例分析

    在网络安全的领域,APT攻击近年来引起了广泛关注。这种高级持续性威胁(APT)通常是由高度专业化的攻击者发起,针对特定目标进行长期、隐蔽的攻击。APT攻击的目标通常是国家级别的机构、企业、科研单位等,它们的攻击方式不仅难以检测,而且往往具有明显的目的性。 回顾APT攻击的历史,我们可以发现其起源与发...

    RackNerd与ColoCrossing的对比分析:选择适合你的数据中心服务

    RackNerd vs ColoCrossing概述 在当前的互联网服务市场中,RackNerd与ColoCrossing都是备受关注的数据中心服务提供商。它们各自的成长背景和市场定位都显示出一些显著的差异。RackNerd成立于2019年,专注于提供低价 VPS 和服务器租用服务,屡次推出吸引人的...

    为小学生选择合适的VPS:安全、易用和高性价比的评测指南

    在这个数字化时代,网络安全受到越来越多人的重视。小朋友们在网络上探索新知识、与朋友沟通时,面对的不仅是丰富的学习资源,还有潜在的网络风险。此时,VPS(虚拟个人服务器)作为一个安全、稳定的网络环境,开始逐渐进入小学生的视野。家长和学校意识到,提供一个良好的网络环境,不仅能保护孩子免受不良信息的侵害,...

    搬瓦工补货通知及高性价比套餐推荐

    搬瓦工的补货通知对许多用户来说非常重要,尤其是在需求不断增加的背景下。补货通知不仅帮助用户了解最新的套餐信息,还能在价格优惠时把握购买机会。对于我而言,时常关注这些通知意味着能以最低的价格获得高配置的套餐,这无疑是提升我网络体验的重要一步。 为了随时获取补货信息,搬瓦工提供了多种渠道供用户选择。大家...

    如何开启BBR查询并提升TCP网络性能

    BBR(Bottleneck Bandwidth and Round-trip propagation time)是一种由Google开发的TCP拥塞控制算法,我对它的了解让我感到非常兴奋。BBR旨在通过精确的网络条件监测,以提高传输速度和稳定性。传统的拥塞控制算法往往依赖于丢包率的变化来调整传输速...

    xTom:灵活可靠的IaaS解决方案,为企业提供优秀网络服务

    xTom是一家成立于2012年的私人控股公司,总部位于德国杜塞尔多夫。它专注于基础设施即服务(IaaS),为各种规模的企业提供可靠的网络和数据中心服务。我对这家公司印象深刻,因为他们提供的解决方案不仅全面,而且非常灵活,能够满足不同客户的需求。 作为一个专业的IaaS提供商,xTom涵盖的服务范围非...