WordPress环境搭建(CentOS7)

今天在阿里云上部署了一台c7,作为www.zhangzisu.cn服务器,计划部署WordPress。现记录配置过程如下:

File: /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
File: /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
File: /etc/nginx/conf.d/wordpress.conf
server {
    server_name  www.zhangzisu.cn;
    root   /var/www/wordpress;
    index index.php;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
    rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $request_filename;
        include        fastcgi_params;
    }
}
yum install deltarpm epel-release yum-utils -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php73
yum-config-manager --enable nginx-mainline
yum install php73-php php73-php-fpm php73-php-gd php73-php-mysqlnd mariadb-server mariadb nginx unzip -y
systemctl enable nginx mariadb php73-php-fpm
systemctl start nginx mariadb php73-php-fpm
# Set password for mariadb root user
mysqladmin password -u root
systemctl reload nginx php73-php-fpm
wget https://wordpress.org/latest.zip
unzip latest.zip
cp -r wordpress /var/www
rm -rf latest.zip wordpress/
chown -R nginx:nginx /var/www/wordpress/

发表评论

电子邮件地址不会被公开。 必填项已用*标注