主要资料参考:https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7

1、安装 nginx:

yum install epel-release

yum install nginx  使用 yum 安装

systemctl start nginx.service  开启 nginx 服务

systemctl enable nginx.service  跟随系统启动

2、安装 MySQL(MariaDB)

yum install mariadb-server mariadb  使用 yum 安装

systemctl start mariadb  启动数据库

systemctl enable mariadb  开机启动

mysql_secure_installation  设置安全策略,会询问以下5个问题

a)为root用户设置密码
  b)删除匿名账号
  c)取消root用户远程登录
  d)删除test库和对test库的访问权限
  e)刷新授权表使修改生效

mysql -u root -p  连接数据库

连接数据库后就可以使用命令操作数据库了,如:create database wordpress; 这里我们需要先创建一个 wordpress 数据库

3、安装 PHP

yum install php php-mysql php-fpm  安装 PHP 和必须的连接 MySQL 和 Nginx 的扩展

vi /etc/php.ini  配置 PHP:

  cgi.fix_pathinfo=0  这行前的分号去掉,将1改为0

vi /etc/php-fpm.d/www.conf  编辑服务器连接配置:

  listen = /var/run/php-fpm/php-fpm.sock  将 listen 的值改为此值

  listen.owner = nobody  这行前的分号去掉

  listen.group = nobody  这行前的分号去掉

  user = nginx
  group = nginx  将这两行的值由 apache 改为 nginx

systemctl start php-fpm

systemctl enable php-fpm

4、配置 Nginx 到 PHP

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

server {
listen 80;
server_name tirion.me www.tirion.me; # note that these lines are originally from the "location /" block
root /home/www/wordpress; # 配置 wordpress 的目录路径
index index.php index.html index.htm; location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

systemctl restart nginx

*上传文件默认为1M,需要修改 nginx.con, nginx.conf.default 和 php.ini 文件来配置上传文件的大小。


5、安装 FTP

yum install vsftpd  安装 FTP 服务

systemctl start vsftpd.service

systemctl enable vsftpd.service

vi /etc/vsftpd/vsftpd.conf  修改 FTP 配置:

  anonymous_enable=NO  这行改为 NO,不允许匿名登录

允许 root 用户使用 FTP:

  vi /etc/vsftpd/ftpusers 去掉或注释掉 root

  vi /etc/vsftpd/user_list 去掉或注释掉 root

配置 iptables:

  iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT

systemctl restart vsftpd.service  重启 FTP 服务

6、安装 WordPress

1) 从 https://cn.wordpress.org/ 下载 WordPress 安装包,解压后通过 FTP 上传到服务器相应的目录,这里就是 /home/www/wordpress

2) chmod 777 -R wordpress  给 WordPress 权限

3) 通过 url 访问:http://tirion.top/wp-admin/install.php 进行自动安装

4) 根据需要进行配置 MySQL 连接的用户名、密码、使用的数据库名,进行安装即可

7、安装 phpmyadmin 参考:

http://www.smalljacky.com/linux/centos/centos7-install-setup-nginx-mariadb-php-phpmyadmin-lemp/

CentOS 7 安装 WordPress,PHP,Nginx,MySQL(MariaDB),FTP的更多相关文章

  1. CentOS 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

    转载自:https://linux.cn/article-4314-1.html 编译自:http://xmodulo.com/install-lemp-stack-centos.html 作者: D ...

  2. [转载]CentOS 下安装LEMP服务(Nginx、MariaDB/MySQL和PHP)

    LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作用.正如其名称所暗示的, LEMP 包是由 Linux.nginx.MariaDB/MySQL 和 P ...

  3. CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

    原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作 ...

  4. centos7安装Lnmp(Linux+Nginx+MySql+Php+phpMyAdmin+Apache)

    centos7安装Lnmp(Linux+Nginx+MySql+Php)及Apache   Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx是一个高性能的HTTP和反向代理服务器,Ng ...

  5. 于CentOS 6 安装 Wordpress

    1.两种方式给Wordpress 首先,你可以去wordpress最新的官方网站看看wordpress多少下载.例wordpress 3.9.1下载地址: http://cn.wordpress.or ...

  6. centos下gitlab私服完整安装部署(nginx+MySQL+redis+gitlab-ce+gitlab-shell+)

    系统环境cat /etc/redhat-release CentOS release 6.8 (Final) nginx -vnginx version: nginx/1.9.15 redis-cli ...

  7. CentOS 7安装WordPress

    在开始本文前,我假定你已经安装好了nginx.php-fpm和mariaDB(或mysql).它们的安装过程可参考我以前的文章. 1. 安装EPEL(Extra Packages for Enterp ...

  8. CentOS 7 安装php5.6,Nginx,Memcached环境及配置

    安装php5.6版本以后不再需要安装Zend Guard,而是用yum命令安装php-opcache及php-pecl-apcu就可以有效的提高php执行速度. 1. 配置yum源 事先确认yum源的 ...

  9. centos 快速安装wordpress

    1.两种方式得到Wordpress 首先你可以去wordpress官方网站看下最新的wordpress的下载地址多少.比如wordpress 3.9.1的下载地址是: http://cn.wordpr ...

随机推荐

  1. Buffer、Channel示例

      a.txt 孔雀向西飞,今朝更好看.孔雀向西飞,今朝更好看.孔雀向西飞,今朝更好看.孔雀向西飞,今朝更好看. 示例一. package com.test; import java.io.FileI ...

  2. iOS 8 以后 MKMapView 代理不执行问题

    因为ios8上,如果你使用了mapView,必须设置mapView的大小,必须把它添加显示在视图上. 可以将frame设为(0,0,0.1,0.1)  

  3. TypeScript Handbook 1——基本类型(翻译)

    原文出处: http://www.typescriptlang.org/Handbook 基于对web开发的需要和对安神的崇拜,打算学习一下typescript. 能力有限,基本属于在自己认识的基础上 ...

  4. centos7安装

    1.准备工具 VMware,我用的是 VMware11 2.打开VMware,创建新的虚拟机 3.选择典型-->下一步 4.稍后安装操作系统-->下一步 5.选择linux操作系统,lin ...

  5. windows下安装rabbitmq的php扩展amqp

    最近研究rabbitmq队列,linux安装这样的软件一向都是很方便的,但是windows可能会比较麻烦,所以对windows的安装做个记录. windows上使用的php扩展为dll文件,首先去下载 ...

  6. Alpha版使用说明书

     游戏规则:             玩家是黑色的小煤球哦!             通过方向键或者ASDW,来控制小球移动(上.下.左.右).             累计时间,直到碰到了红色的小球 ...

  7. iOS AVCaptureSession 小视频开发总结,支持设备旋转

    iOS开发中当我们想要自定义相机拍照或摄像界面时,UIImagePickerController无法满足我们的需求,这时候我们可以使用AVFoundation.framework这个framework ...

  8. 从service弹出系统级自定义提示框,可在任意页面弹出

    添加权限 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> // 显示 ...

  9. Draw_extend使用OpenGL显示数据点

    //alter load_map.dev //safety verion 2016/1/12 #include <iostream> #include <fstream> #i ...

  10. IOS atomic与nonatomic,assign,copy与retain的定义和区别

    IOS atomic与nonatomic,assign,copy与retain的定义和区别 atomic和nonatomic用来决定编译器生成的getter和setter是否为原子操作.        ...