0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ubuntuにwordpressをセットアップする手順及び設定。

Posted at

今回の設定では、ubuntu Apache PHP Mysql等は設定すみで、バーチャルドメイン下のディレクトリ内での設定を条件に記述します。
今回の例はレンタルのクラウドVPS利用し、vscode等にてssh接続可能と言う前提です。
参考サイト:https://www.kagoya.jp/howto/cloud/vps/usevps/
こちらも参考まで。
https://qiita.com/shinsakujazzbass/items/dff4955d56f8426ceb96
/var/www/の直下にバーチャルドメインとしディレクトリ作成例として。

# mkdir samplewp //samplewpバーチャルドメインとして設定cerbot利用でhttps化。
# wget https://ja.wordpress.org/wordpress-6.7.2-ja.tar.gz //WordPressサイトよりDL
# tar -xzvf wordpress-6.7.2-ja.tar.gz //解凍されwordpressディレクトリ生成される。
# rm -rf samplewp //一旦samplewp削除。
# mv wordpress samplewp //新たにsamplwpを作成。
# chown -R www-data:www-data samplewp //ユーザを必ずwww-dataに変更。

この時点で、ターミナルまたは、vscode等のエディタにて編集できる様準備する。
後は、Mysql上にsample_db等のデータベースをphpMyAdmin等で作成。
そのデーtベースに合わせ、WordPress設定をする。
また今回サーバのPHPバージョンが、複数ありディレクトリ毎にバージョンを指定する設定も紹介します。

# update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.4   120       auto mode
* 1            /usr/bin/php7.3   100       manual mode //デフォルトで利用設定
  2            /usr/bin/php8.4   120       manual mode //ディレクトリ内で利用可能

Press <enter> to keep the current choice[*], or type selection number:

と言う状況でのWordPress最新のPHP8以上推奨なのでsamplewpの直下に.htaccessに下記を記述する事でPHP8.4利用可能となる。

<FilesMatch "\.php$">
  SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost"
</FilesMatch>

参考サイト:https://qiita.com/shinsakujazzbass/items/e3093f17d2e677950c1b
ubuntu独特設定も有るので、投稿しまた。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?