LoginSignup
0
3

More than 5 years have passed since last update.

WebサーバにWordPressのインストール

Last updated at Posted at 2017-12-15

WebサーバにWordPressのインストール

前回作ったRaspberryPi で作った無線Webサーバ(nginx)
WordPressをインストールしました。

1.wordpressのインストール

sudo su
apt-get install php7.0 php7.0-fpm php7.0-mysql php7.0-mbstring php7.0-intl mysql-server
cp /etc/nginx/sites-enabled/wp.conf /etc/nginx/sites-enabled/wp.conf.bk
vi /etc/nginx/sites-enabled/wp.conf
*********************************************
server{
        listen 80;
        server_name #サイトのアドレス;
        index   index.php index.html index.htm;
        root    /var/www/html;
        try_files $uri $uri/ /index.php?q=$uri&$args;
        location ~ \.php$ {
                root    /var/www/html;
                fastcgi_pass    unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME /media/usb0/sites/wp;
                include         fastcgi_params;
        }
}
*********************************************

cd /etc/php/7.0/cli/php.ini
cp /etc/php/7.0/cli/php.ini /etc/php/7.0/cli/php.ini.bk
vi /etc/php/7.0/cli/php.ini



# php.ini内のパラメータを設定
memory_limit=128M
cd /etc/php/7.0/fpm/pool.d
cp www.conf www.conf.bk
vim www.conf
php_admin_value[memory_limit] = 32M; #余裕がある人は64Mでもいいかも

service nginx restart
service mysql start

2.phpmyadminの設定

vi /etc/nginx/conf.d/phpmyadmin.conf
*********************************************
server {
        listen 80;
        root /var/www/phpmyadmin;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name phpmyadmin.nekoberry
        location / {
                try_files $uri $uri/ =404;
        }
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }
}
*********************************************

udo mysql -u root
grant all on . to 'phpmyadmin'@'127.0.0.1’ identified by 'password’;

cd /var/www/phpmyadmin/
sudo vi config.inc.php
*********************************************
/**
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['user'] = 'phpmyadmin';
$cfg['Servers'][$i]['password'] = 'password';
$cfg['Servers'][$i]['extension'] = 'mysqli';
MYSQL
mysql_secure_installation
*********************************************

cd /var/www/html
wget https://ja.wordpress.org/wordpress-4.9-ja.tar.gz
tar xzvf https://ja.wordpress.org/wordpress-4.9-ja.tar.gz
mysql -u root
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8;
CREATE USER 'wordpress’@'127.0.0.1’ IDENTIFIED BY 'password’;
grant all on wordpress.* to 'wordpress’@'127.0.0.1’ identified by 'password’;
/q
mysql -u ユーザ名 -h 127.0.0.1 -p データベース名(例:mysql -u wordpress -h 127.0.0.1 -p wordpress)
wordpress

cp wp-config-sample.php wp-config.php
vi wp-config.php

※差分diff

root@usaberrypi:/var/www/html/wordpress# diff wp-config.php wp-config-sample.php
29c29
< define('DB_NAME', 'wordpress');
---
> define('DB_NAME', 'database_name_here');
32c32
< define('DB_USER', 'wordpress');
---
> define('DB_USER', 'username_here');
35c35
< define('DB_PASSWORD', 'password');
---
> define('DB_PASSWORD', 'password_here');
38c38
< define('DB_HOST', '127.0.0.1');
---
> define('DB_HOST', 'localhost');
94d93
<

ブラウザ上で以下を入力し確認

IPアドレス/wordpress/wp-admin/install.php

WordPressの設定画面が出たら正解。

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3