LoginSignup
0
1

More than 1 year has passed since last update.

Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 + PHP 8.1 - WordPressインストール

Posted at

前提

ようやく WordPress のインストール。ここまで長かった!

環境

Ubuntu 22.04
Nginx 1.22.1
MariaDB 10.6.11
PHP 8.1

設定

WordPress のダウンロード

tmpディレクトリへ移動して、WordPress をダウンロードする。

$ cd /tmp
$ wget https://ja.wordpress.org/latest-ja.tar.gz
$ tar -xvzf latest-ja.tar.gz

WordPress のインストール

tmpディレクトリから/var/www/wordpress/にダウンロードした WordPress ファイルを移動。

$ sudo mv wordpress /var/www/html/wordpress

www-dataに WordPress ディレクトリへの権限を与える。

$ sudo chown -R www-data:www-data /var/www/html/wordpress
$ sudo chmod -R 755 /var/www/html/wordpress/

フォルダの中に用意されているwp-config-sample.phpのファイル名をwp-config.phpに変更。

$ sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php

wp-config.phpに MariaDB で設定したユーザ名やパスワードの情報を追記。

$ sudo vi /var/www/html/wordpress/wp-config.php

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** Database username */
define( 'DB_USER', 'username_here' );

/** Database password */
define( 'DB_PASSWORD', 'password_here' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

オプション

PHP のインストールの時に設定していればいいんだけど、設定してないかもしれない方は確認しておくといい。

$ sudo cat /etc/nginx/sites-available/default 

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
        include snippets/fastcgi-php.conf;

        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        #       # With php-cgi (or other tcp sockets):

        }
}
$ sudo systemctl restart nginx

WordPress の確認

ブラウザから http://X.X.X.X/wordpress を開いて、表示されればOK
image.png

0
1
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
1