首页 技术 正文
技术 2022年11月8日
0 收藏 951 点赞 1,225 浏览 1532 个字

用centos6.9搭建wordpress
Linux、Nginx、Mariadb(Mysql)、PHP

1
yum install nginx mariadb php php-fpm php-mysql
nginx与mariadb需要添加源
cd /etc/yum.repos.d/
vim nginx.repo
填写如下内容:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1

mariadb类似,在centos7.0自带MariaDB源

2
获取最新的wordpress安装程序,解压到/var/www/html/目录下。
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
tar -xvf wordpress-4.8.1-zh_CN.tar.gz -C /var/www/html/
cd /var/www/html/
ls
wordpress

3
权限配置
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx

chown nginx.nginx /usr/share/nginx/html/ -R #设置目录所有者
chmod 755 /usr/share/nginx/html/ -R #设置目录权限

4
配置nginx根路径
    location / {
        #root   /usr/share/nginx/html;
        root   /var/www/html;
        index  index.html index.htm index.php;
    }
配置nginx转发支持php
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
        include        fastcgi_params;
    }
    
5    
配置完成后重新加载配置
nginx -s reload

启动php-fpm
service php-fpm start

6
linux防火墙,iptables,与selinux
centos6.9
关闭iptables
service iptables stop #临时
chkconfig iptables off #永久
可以配置iptables开放端口

关闭selinux,
setenforce 0 #临时
修改/etc/selinux/config 文件永久关闭
将SELINUX=enforcing改为SELINUX=disabled
也可以配置策略

没有关闭selinux可能提示access denied
nginx错误打印FastCGI sent in stderr: “Unable to open primary script

7
数据库配置

mysql -uroot
create database wordpress;
grant all on wordpress.* to sqladmin@localhost identified by “123456”;

8 浏览器访问http://ip/wordpress
根据提示完成数据库与用户设置

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,114
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,586
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,432
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,203
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,838
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,923