欢迎光临散文网 会员登陆 & 注册

wordpress部署教程

2023-02-15 10:48 作者:学酥两支笔  | 我要投稿

1 更新yum

yum update -y


2 新建用户

useradd -d /home/huchangyi -m huchangyi


修改用户密码

passwd huchangyi


3 安装ftp

yum install vsftpd

systemctl enable vsftpd

systemctl restart vsftpd


4 安装php

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum -y install php72w

yum -y install php72w-common php72w-fpm php72w-opcache php72w-gd php72w-mysqlnd php72w-mbstring php72w-pecl-redis php72w-pecl-memcached php72w-devel php72w-embedded php72w-cli php72w-pdo php72w-xml

systemctl enable php-fpm

systemctl restart php-fpm


5 安装nginx

yum list |grep nginx

yum install nginx

systemctl enable nginx

systemctl restart nginx


6 安装mysql

查看最新的源

https://dev.mysql.com/downloads/repo/yum/


下载mysql的repo源

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm


安装mysql-community-release-el7-5.noarch.rpm包

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum -y install mysql57-community-release-el7-11.noarch.rpm


安装这个包后,会获得两个mysql的yum repo源

/etc/yum.repos.d/mysql-community.repo

/etc/yum.repos.d/mysql-community-source.repo


安装

yum -y install mysql-server


重置mysql密码

mysql -u root

use mysql;

delete from user where user=”;

update user set password=password(‘huchangyi′) where user=’root’;

GRANT ALL ON . TO root@’%’;

FLUSH PRIVILEGES;

select user,host,password from user;

exit;


重启

systemctl restart mysqld

systemctl enable mysqld


7 下载wordpress

cd /home/huchangyi

wget https://cn.wordpress.org/latest-zh_CN.zip

解压

unzip huchangyi.zip


8 配置nginx

vim /etc/nginx/conf.d/huchangyi.conf

内容如下:

server {

    listen 80;

    #listen 443 ssl;

    server_name  huchangyi.com wp.huchangyi.com;

    #ssl_certificate   /etc/nginx/conf.d/214616336130727.pem;

    #ssl_certificate_key  /etc/nginx/conf.d/214616336130727.key;

    #ssl_session_timeout 5m;

    #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    #ssl_prefer_server_ciphers on;

    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;


    location / {

root   /home/huchangyi/wordpress;

index  index.html index.htm index.php;

if (!-d $request_filename){

set $rule_0 1$rule_0;

}

if ($rule_0 = "1"){

rewrite ^/(.*)/$ /$1 permanent;

}

if (!-d $request_filename){

set $rule_1 1$rule_1;

}

if (!-f $request_filename){

set $rule_1 2$rule_1;

}

if ($rule_1 = "21"){

rewrite ^/ /index.php last;

}

}


    #error_page  404              /404.html;


    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }


    # proxy the PHP scripts to Apache listening on 127.0.0.1:80

    #

    #location ~ \.php$ {

    #    proxy_pass   http://127.0.0.1;

    #}


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    

    location ~ \.php$ {

        root           /home/huchangyi/wordpress;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        include        fastcgi_params;

        }


    # deny access to .htaccess files, if Apache's document root

    # concurs with nginx's one

    #

    #location ~ /\.ht {

    #    deny  all;

    #}

}


wordpress部署教程的评论 (共 条)

分享到微博请遵守国家法律