当前位置:首页 > CMS教程 > WordPress > 列表

lnmp安装wordpress

发布:smiling 来源: PHP粉丝网  添加日期:2019-01-02 15:51:02 浏览: 评论:0 
#epel 源
yum install epel-release
 
#nginx
yum install nginx -y
 
#开机自动启动
chkconfig nginx on
 
#mariadb/mysql变体
yum install mariadb mariadb-server
 
#开机自动启动
systemctl enable mariadb
 
#启动
service mariadb start
 
#db 安全配置
mysql_secure_installation
 
#进入db并创建数据库
mysql -uroot --password=
CREATE DATABASE wordpress;
exit
 
#php
yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql -y
 
#启动
service php-fpm start
 
#开机
chkconfig php-fpm on
 
#下载wordpress
cd /var/www/
 
wget http://wordpress.org/latest.tar.gz
tar-xzvf latest.tar.gz
cp wordpress/wp-config-sample.php  wordpress/wp-config.php
nano wordpress/wp-config.php
 
define('DB_NAME','wordpress');
define('DB_USER','root');
define('DB_PASSWORD','');
 
#nginx配置
cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf
nano /etc/nginx/nginx.conf
 
server 部分变为:
    upstream php {
      #server unix:/tmp/php-cgi.socket;
      #指向到fpm的默认9000端口,
      server 127.0.0.1:9000;
    }
 
    server {
      listen  80 ;
      listen  [::]:80 ;
      server_name www.domain.com;
      root   /var/www/wordpress/;
      index  index.php;
 
      location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi.conf;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
      }
 
      # Load configuration files for the default server block.
      include /etc/nginx/default.d/*.conf;
    }
 
#加载配置并重启
nginx -t
service nginx restart
 
#浏览器打开
http://localhost/wp-admin/install.php

Tags: lnmp wordpress

分享到: