您现在的位置是:首页 > cms教程 > WordPress教程WordPress教程

CentOS 6.4 php环境配置安装wordpress的方法

怀亦2025-03-20WordPress教程已有人查阅

导读1. nginx php-rpm 包升级,2. 安装mysql,3. 安装nginx,这时你可以直接访问ip或者域名,查看nginx是否安装成功4. 安装php

1. nginx php-rpm 包升级
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
2. 安装mysql
sudo yum install mysql mysql-serversudo /etc/init.d/mysqld restartsudo /usr/bin/mysql_secure_installation
3. 安装nginx
sudo yum install nginx
sudo /etc/init.d/nginx start
这时你可以直接访问ip或者域名,查看nginx是否安装成功
4. 安装php
sudo yum --enablerepo=remi install php-fpm php-mysql
5. 配置php
sudo vi /etc/php.ini
#cgi.fix_pathinfo=1
cgi.fix_pathinfo=0
doc_root = /usr/share/nginx/html
6. 配置nginx
默认的配置文件nginx.conf
sudo vi /etc/nginx/nginx.conf
processer = 4
sudo vi /etc/nginx/conf.d/default.conf
#
# The default server
#
server {
listen 80;
server_name example.com;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
1) location 下
添加index.php
2) root 可以改成你想要的位置,如/var/ /wordpress
3)server_name 改成你的域名或者ip或者localhost
4) location ~ \.php$ { 下面的root要和上面location的一样
5)fastcgi_param 帮助php解释器在document root找到php脚本
7. 配置php-fpm
sudo vi /etc/php-fpm.d/ .conf
替换apahce到nginx
[...]
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
[...]
重启php-fpm
sudo service php-fpm restart
8.添加php测试页面
sudo vi /usr/share/nginx/html/info.phpsudo service nginx restart
9. 添加开机自动重启
sudo chkconfig --levels 235 mysqld on
sudo chkconfig --levels 235 nginx on
sudo chkconfig --levels 235 php-fpm on
上面环境配置好以后就可以安装wordpress了
1. 下载并解压
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
2. 创建数据库
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost;
SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
3. 配置wordpress
复制配置文件并配置
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.phpvi ~/wordpress/wp-config.php// ** 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', 'wordpressuser');
/** MySQL database password */
define('DB_PASSWORD', 'password');
复制wordpress到nginx的root目录下,
sudo cp -r ~/wordpress/* /var/ /html
可能需要php-gd
sudo yum install php-gd
重启nginx
sudo service httpd restart
4 安装wordpress
访问你的域名http:xxx.com/wp-admin/install.php 来安装,很简单。
这样一个wordpress的博客配置就完成了。

本文标签:

很赞哦! ()

相关源码

  • (自适应)大气壁挂炉暖气设备家用电器模板带加盟申请和下载资料为壁挂炉、暖气片等供暖设备企业设计的PbootCMS模板,通过响应式技术实现跨终端展示产品参数和技术细节。后台统一管理确保采暖系统数据、服务网点信息实时同步更新查看源码
  • html5响应式pbootcms模板新闻资讯博客网站源码该模板采用PbootCMS内核开发,专为新闻资讯类网站打造,同时具备高度行业适配性--只需替换图文内容即可快速转型为企业官网、行业门户等各类站点。查看源码
  • (自适应响应式)个人作品技术文章博客网站模板下载基于PbootCMS内核开发的响应式博客模板,为数字营销、技术分享类内容打造。采用前沿设计理念,兼顾内容展示与阅读体验,适配各类终端设备。通过本模板可快速构建专业级行业博客,有效传播专业知识与案例成果。查看源码
  • 自适应html5二极管LED灯具灯饰类企业网网站模板该PbootCMS内核开发的响应式模板专为LED照明、灯具制造类企业设计,通过HTML5技术实现手机与PC端自适应显示,确保跨设备访问体验一致。企业可快速替换图文内容适配其他工业领域查看源码
  • (自适应)科技产品设备技术作品pbootcms网站模板带下载和招聘基于PbootCMS内核开发的高端科技企业模板,采用响应式布局技术,适配各类移动终端设备。模板设计聚焦科技行业特性,通过模块化结构实现企业形象展示、技术成果发布与人才招募等核心需求查看源码
  • 帝国cms7.5品牌连锁店招商加盟商机网站模版源码本模板为招商加盟、创业投资、品牌连锁等商业领域设计,采用帝国CMS7.5内核构建,整体风格简洁大气,突出商业信任感与专业度,适合各类招商加盟项目展示、品牌连锁店宣传等商业应用场景。查看源码
分享笔记 (共有 篇笔记)
验证码: