ZFWordPress™

WordPress + CentOS 覚書

3560 views
It takes about 4 minute(s) to read this content.

WordPress

 

Install

CentOS 7 + Nginx + php 7 + Let’s Encrypt WEBサーバの覚書

  • 前ポストのような設定をしたサーバに wget をインストール
  • wget を使って WordPress 本体をダウンロード
  • 適当な場所に解凍する
  • nginx のドキュメントルートの設定に矛盾がないように解凍されたフォルダを移動する
<wordpress ディレクトリを作っていた場合は削除しておく>
$ sudo rm -r /var/www/html/wordpress/
$ sudo yum install wget
$ wget https://ja.wordpress.org/latest-ja.tar.gz
$ tar xzvf latest-ja.tar.gz
$ sudo mv ./wordpress/ /var/www/html/

Settings

  • MariaDB の設定
    • WordPress DB を作成Wordpress DB 用 ユーザを作成
$ mysql -uroot -p
Enter password: <設定した root パスワードを入力>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9686Server version: 10.3.10-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database <WordPress用DB名>;
MariaDB [(none)]> grant all privileges on <WordPress用DB名>.* to "<WordPress用 DBユーザ名>"@"localhost" identified by "<WordPress用 DBユーザのパスワード>";
MariaDB [(none)]> flush privileges;
  • WordPress 設定ファイルの編集
  • サンプルファイルをコピーして設定ファイルを作成する
$ sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
$ sudo vim /var/www/html/wordpress/wp-config.php <丁寧な説明が書いてあるので参照すること>
  • オーナー・グループの変更
  • パーミッションの変更
$ sudo chown -R nginx:nginx /var/www/html/wordpress
$ sudo chmod -R 0700 /var/www/html/wordpress/
  • WordPress の最大アップロードサイズの変更
<php.ini の変更>
$ sudo vim /etc/php.ini
<post_max_size を探してサイズを指定する>
post_max_size = 25M
<upload_max_filesize を探してサイズを指定する>
upload_max_filesize = 20M
<nginx 設定ファイルの編集>
$ sudo vim /etc/nginx/sites-available/YOUR.SERVER.NAME.config
<下記 location ディレクティブを編集>
  location ~ \.php$ {
    client_max_body_size 25m; <この行を追加する>
    root           /var/www/html/wordpress;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    include        fastcgi_params;
  }
  • nginx の再起動
  • php-fpm の再起動
$ sudo systemctl restart nginx
$ sudo systemctl restart php-fpm

Comments

No commented yet.

Share on FacebookShare on TwitterShare on Pinterest