2021/04/25追記: この手順はOracle Autonomouse Linuxが通常のOracle Linuxとは異なるレポジトリで運用されていた2020年12月以前のものです。
2020年12月にOracle Autonomous Linuxでレポジトリ仕様の変更があった がありましたので、現状は普通のOracle Linux環境として設定できますので「CentOS 7 / Oracle Linux 7でWordPressサーバを建てる 」を参照ください。
WebサーバをApacheではなくnginxで構成したい、という場合はこの記事を参照してもいいかもしれません。
2023/09/07追記: 2022年ごろ以降のOracle CloudではFree TierでOracle Autonomouse Linuxを使う事ができなくなっています。
Oracle CloudのTOKYOリージョンでFree tierのOracle Autonomouse Linux 7.8環境の作成が出来た。
できたんだけど、標準で提供されているレポジトリの範囲が狭く、通常のOracle Linux 7.8の標準レポジトリにも足りていない。
このため、wordpressサーバを建ててみるかと思っても、要求されるphpおよびmariadbのバージョンに足りていない。
Oracle Autonomous Linuxとしてのマニュアルがなく、ソフトウェア追加に関する制限事項等が分からないが、他に使い道も無いので、通常のOracle Linux 7.8で設定されているレポジトリとかを追加してみることにした。
注意:普通のOracle Linux 7.8やCentOS7にWordpressをインストールする場合は「CentOS 7 / Oracle Linux 7でWordPressサーバを建てる 」を参照してください。
php 7.4追加編
いろいろある中、Oracle自身が出していてOracle Linux 7.8でも追加できるPHP Packages for Oracle Linux かな、と追加してみる。
Oracle Linuxのレポジトリ設定の中からphp7.4部分を抜き出して /etc/yum.repos.d/oracle-php.repo というファイルを作成。
2
name=Oracle Linux $releasever PHP 7.4 Packages for Development and test ($basearch)
3
baseurl=https://yum $ociregion.oracle.com/repo/OracleLinux/OL7/developer/php74/$basearch/
そしてphpをインストール
3
--> Finished Dependency Resolution
7
================================================================================
8
Package Arch Version Repository Size
9
================================================================================
11
php x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 3.4 M
12
Installing for dependencies:
13
apr x86_64 1.4.8-5.el7 al7 103 k
14
apr-util x86_64 1.5.2-6.0.1.el7 al7 91 k
15
httpd x86_64 2.4.6-93.0.1.el7 al7 1.2 M
16
httpd-tools x86_64 2.4.6-93.0.1.el7 al7 92 k
17
mailcap noarch 2.1.41-2.el7 al7 30 k
18
php-cli x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 5.1 M
19
php-common x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 1.1 M
22
================================================================================
23
Install 1 Package (+7 Dependent packages)
25
Total download size: 11 M
30
php.x86_64 0:7.4.7-1.0.1.el7
33
apr.x86_64 0:1.4.8-5.el7 apr-util.x86_64 0:1.5.2-6.0.1.el7
34
httpd.x86_64 0:2.4.6-93.0.1.el7 httpd-tools.x86_64 0:2.4.6-93.0.1.el7
35
mailcap.noarch 0:2.1.41-2.el7 php-cli.x86_64 0:7.4.7-1.0.1.el7
36
php-common.x86_64 0:7.4.7-1.0.1.el7
httpdも一緒にインストールされました。
また、wp-cliで使うphp-jsonとサイトヘルスで表示されるエラー対応としてphp-bcmath を追加します。
1
# yum install php-json php-bcmath
3
--> Finished Dependency Resolution
7
================================================================================
8
Package Arch Version Repository Size
9
================================================================================
11
php-bcmath x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 56 k
12
php-json x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 58 k
15
================================================================================
18
Total download size: 114 k
しかし、AMP pluginで使うphp-pear-Net-Curlとサイトヘルスのphp-pecl-imagick はepel系パッケージ、サイトヘルスのphp-gd は依存パッケージのlibvpx(Oracle Linuxでは標準パッケージに含まれる)がなくインストールできなかった。
MariaDB追加編
SQLサーバのmariadb-serverパッケージについては、MariaDB Foundation からmariadb 10.5を導入することにした。
「/etc/yum.repos.d/mariadb.repo」というファイルを作り、以下の内容を入力
1
# MariaDB 10.5 RedHat repository list - created 2020-06-26 04:54 UTC
そののち「yum install MariaDB-server MariaDB-client」を実行してmariadb-serverをインストール
1
# yum install MariaDB-server MariaDB-client
3
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
4
--> Finished Dependency Resolution
5
Error: Package: MariaDB-client-10.5.4-1.el7.centos.x86_64 (mariadb)
6
Requires: libpcre2-8.so.0()(64bit)
7
Error: Package: galera-4-26.4.5-1.el7.centos.x86_64 (mariadb)
9
Error: Package: MariaDB-server-10.5.4-1.el7.centos.x86_64 (mariadb)
10
Requires: libpcre2-8.so.0()(64bit)
11
You could try using --skip-broken to work around the problem
12
You could try running: rpm -Va --nofiles --nodigest
どうやら「pcre2」と「socat」がOracle Autonomous Linuxでは提供されていないパッケージであるようだ。(標準のOralce Linux 7.8ではol7_latestレポジトリに含まれている)
先ほど指定したmariadbレポジトリはRedHat Enterprise Linux 7用だったので、CentOS7用(baseurl=http://yum.mariadb.org/10.5/centos7-amd64 )に変更しても状況は変わらず。
では、とバージョンを10.4に下げてみると成功。成功時のmariadb.repoは以下
1
# MariaDB 10.4 RedHat repository list - created 2020-06-26 06:01 UTC
1
# yum install MariaDB-server MariaDB-client
3
--> Finished Dependency Resolution
7
================================================================================
8
Package Arch Version Repository
10
================================================================================
12
MariaDB-client x86_64 10.4.13-1.el7.centos mariadb 12 M
13
MariaDB-compat x86_64 10.4.13-1.el7.centos mariadb 2.2 M
14
replacing mariadb-libs.x86_64 1:5.5.65-1.el7
15
MariaDB-server x86_64 10.4.13-1.el7.centos mariadb 26 M
16
Installing for dependencies:
17
MariaDB-common x86_64 10.4.13-1.el7.centos mariadb 81 k
18
boost-program-options x86_64 1.53.0-28.el7 al7 156 k
19
galera-4 x86_64 26.4.4-1.rhel7.el7.centos mariadb 9.5 M
20
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 al7 32 k
21
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 al7 57 k
22
perl-DBI x86_64 1.627-4.el7 al7 801 k
23
perl-Data-Dumper x86_64 2.145-3.el7 al7 47 k
24
perl-IO-Compress noarch 2.061-2.el7 al7 259 k
25
perl-Net-Daemon noarch 0.48-5.el7 al7 50 k
26
perl-PlRPC noarch 0.2020-14.el7 al7 35 k
29
================================================================================
30
Install 3 Packages (+10 Dependent packages)
32
Total download size: 51 M
37
MariaDB-client.x86_64 0:10.4.13-1.el7.centos
38
MariaDB-compat.x86_64 0:10.4.13-1.el7.centos
39
MariaDB-server.x86_64 0:10.4.13-1.el7.centos
42
MariaDB-common.x86_64 0:10.4.13-1.el7.centos
43
boost-program-options.x86_64 0:1.53.0-28.el7
44
galera-4.x86_64 0:26.4.4-1.rhel7.el7.centos
45
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
46
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
47
perl-DBI.x86_64 0:1.627-4.el7
48
perl-Data-Dumper.x86_64 0:2.145-3.el7
49
perl-IO-Compress.noarch 0:2.061-2.el7
50
perl-Net-Daemon.noarch 0:0.48-5.el7
51
perl-PlRPC.noarch 0:0.2020-14.el7
54
mariadb-libs.x86_64 1:5.5.65-1.el7
MariaDB設定編
まず、現在のMariaDBサーバの自動起動設定を確認。
1
# systemctl list-unit-files|grep mariadb
2
mariadb.service disabled
3
mariadb@.service disabled
自動起動しない設定になっているので、自動起動するように変更する
1
# systemctl enable mariadb.service
2
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
3
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
4
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
続いてMariaDBの起動状況を確認
1
# systemctl status mariadb
2
● mariadb.service - MariaDB 10.4.13 database server
3
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
4
Drop-In: /etc/systemd/system/mariadb.service.d
5
mqmigrated-from-my.cnf-settings.conf
6
Active: inactive (dead)
「Active: inactive (dead)」なので起動していないので「systemctl start mariadb」で起動する。
1
# systemctl start mariadb
2
# systemctl status mariadb -l
3
● mariadb.service - MariaDB 10.4.13 database server
4
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
5
Drop-In: /etc/systemd/system/mariadb.service.d
6
mqmigrated-from-my.cnf-settings.conf
7
Active: active (running) since Fri 2020-06-26 15:08:58 JST; 37s ago
10
Process: 9464 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
11
Process: 9419 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
12
Process: 9417 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
13
Main PID: 9430 (mysqld)
14
Status: "Taking your SQL requests now..."
15
CGroup: /system.slice/mariadb.service
16
mq9430 /usr/sbin/mysqld
18
Jun 26 15:08:57 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:57 0 [Note] InnoDB: 10.4.13 started; log sequence number 60972; transaction id 21
19
Jun 26 15:08:57 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:57 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
20
Jun 26 15:08:57 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:57 0 [Note] InnoDB: Buffer pool(s) load completed at 200626 15:08:57
21
Jun 26 15:08:57 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:57 0 [Note] Plugin 'FEEDBACK' is disabled.
22
Jun 26 15:08:57 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:57 0 [Note] Server socket created on IP: '::'.
23
Jun 26 15:08:58 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:58 0 [Note] Reading of all Master_info entries succeeded
24
Jun 26 15:08:58 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:58 0 [Note] Added new Master_info '' to hash table
25
Jun 26 15:08:58 oci.adosakana.local mysqld[9430]: 2020-06-26 15:08:58 0 [Note] /usr/sbin/mysqld: ready for connections.
26
Jun 26 15:08:58 oci.adosakana.local mysqld[9430]: Version: '10.4.13-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
27
Jun 26 15:08:58 oci.adosakana.local systemd[1]: Started MariaDB 10.4.13 database server.
MariaDB上にWordpress用のデータベースを作成する。
2
Welcome to the MariaDB monitor. Commands end with ; or \g.
3
Your MariaDB connection id is 8
4
Server version: 10.4.13-MariaDB MariaDB Server
6
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
8
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
10
MariaDB [(none)]> create database DB名 character set utf8;
11
Query OK, 1 row affected (0.000 sec)
13
MariaDB [(none)]> grant all on DB名.* to wordpress@localhost identified by 'w@rdpress';
14
Query OK, 0 rows affected (0.002 sec)
firewall設定
まずfirewallを開ける。
現状のポート開放状況を確認するため「firewall-cmd –list-all」を実行
1
# firewall-cmd --list-all
4
icmp-block-inversion: no
7
services: dhcpv6-client ssh
httpとhttpsを追加して、設定を再読込して反映
1
# firewall-cmd --permanent --zone=public --add-service=http
3
# firewall-cmd --permanent --zone=public --add-service=https
7
# firewall-cmd --list-all
10
icmp-block-inversion: no
13
services: dhcpv6-client http https ssh
Webサーバ設定
nginxへの切り替え
最初はApacheを使おうとしたのですが、Mozilla SSL Configuration Generators 推奨設定を行うにはmod_rewriteやmod_headersが含まれていませんでした。
Apache関連の追加レポジトリを探すよりはWebサーバをnginxに切り替えてnginx公式レポジトリを使った方が良いのでは?ということで「nginx: Linux packages 」を元に追加
/etc/yum.repos.d/nginx.repo に下記を記載
10
name=nginx mainline repo
3
--> Finished Dependency Resolution
7
================================================================================
8
Package Arch Version Repository Size
9
================================================================================
11
nginx x86_64 1:1.18.0-1.el7.ngx nginx-stable 772 k
14
================================================================================
17
Total download size: 772 k
また、あとで確認したところphp-fpmも必要だったのでインストールします。これはサービスとしても起動します。
2
Loaded plugins: langpacks
4
--> Running transaction check
5
---> Package php-fpm.x86_64 0:7.4.7-1.0.1.el7 will be installed
6
--> Finished Dependency Resolution
10
================================================================================
11
Package Arch Version Repository Size
12
================================================================================
14
php-fpm x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 1.7 M
17
================================================================================
20
Total download size: 1.7 M
24
# systemctl list-unit-files|grep php
25
php-fpm.service disabled
26
# systemctl enable php-fpm.service
27
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
28
# systemctl start php-fpm.service
現在のApacheとnginxの自動起動設定を確認するため「systemctl list-unit-files|grep -e http -e nginx」を実行
1
# systemctl list-unit-files|grep -e http -e nginx
3
nginx-debug.service disabled
どちらも起動状態にないことを確認。
nginxを自動起動にしてから起動
1
# ystemctl enable nginx.service
2
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
3
# systemctl start nginx.service
4
# systemctl status nginx.service -l
5
● nginx.service - nginx - high performance web server
6
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
7
Active: active (running) since Fri 2020-06-26 15:58:01 JST; 5s ago
9
Process: 10409 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
10
Main PID: 10410 (nginx)
11
CGroup: /system.slice/nginx.service
12
tq10410 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.con
13
mq10411 nginx: worker process
15
Jun 26 15:58:01 oci.adosakana.local systemd[1]: Starting nginx - high performance web server...
16
Jun 26 15:58:01 oci.adosakana.local systemd[1]: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
17
Jun 26 15:58:01 oci.adosakana.local systemd[1]: Started nginx - high performance web server.
ブラウザからアクセスできるか確認
Let’s encryptを利用したSSLアクセス有効化
Oracle Autonomous Linuxにはcertbotもdehydratedもありません。
certbotはpython環境を使い大がかりになってしまうので、dehydrated の方を使用します。
githubのdehydrated からダウンロードします。
5
drwxrwxr-x. 4 root root 4096 Apr 29 04:36 dehydrated-master
6
-rw-r--r--. 1 root root 82951 Jun 26 16:32 master.tar.gz
dehydrated と config を配置します。
1
# cp dehydrated-master/dehydrated /usr/local/sbin/
2
# ls -l /usr/local/sbin/dehydrated
3
-rwxr-xr-x. 1 root root 69787 Jun 26 16:35 /usr/local/sbin/dehydrated
4
# mkdir /usr/local/etc/dehydrated
5
# cp dehydrated-master/docs/examples/config /usr/local/etc/dehydrated
6
# ls -l /usr/local/etc/dehydrated
8
-rw-r--r--. 1 root root 4656 Jun 26 16:36 config
/usr/local/etc/dehydrated/domains.txt にSSL証明書を取得するドメイン名を列挙します。
dehydratedがSSL証明書取得の際に使用する作業用Web公開ディレクトリ /var/www/dehydrated に関する設定をnginxに行います。
まず、ディレクトリを作成
1
# mkdir /var/www/dehydrated
次にnginx側の設定 を /etc/nginx/conf.d/default.conf のlisten 80に関するlocaltionに下記を追加。
1
location ^~ /.well-known/acme-challenge {
2
alias /var/www/dehydrated;
そして、nginx再起動
1
# systemctl restart nginx
準備が出来たのでdehydratedで登録を開始。
2
# INFO: Using main config file /usr/local/etc/dehydrated/config
6
To accept these terms of service run `/usr/local/sbin/dehydrated --register --accept-terms`.
7
# /usr/local/sbin/dehydrated --register --accept-terms
8
# INFO: Using main config file /usr/local/etc/dehydrated/config
9
+ Generating account key...
10
+ Registering account key with ACME server...
11
+ Fetching account URL...
前処理が完了したので、実際のSSL証明書発行処理を実施。
1
# /usr/local/sbin/dehydrated --cron
2
# INFO: Using main config file /usr/local/etc/dehydrated/config
3
Processing oci.adosakana.local
4
+ Creating new directory /usr/local/etc/dehydrated/certs/oci.adosakana.local ...
6
+ Generating private key...
7
+ Generating signing request...
8
+ Requesting new certificate order from CA...
9
+ Received 1 authorizations URLs from the CA
10
+ Handling authorization for oci.adosakana.local
11
+ 1 pending challenge(s)
12
+ Deploying challenge tokens...
13
+ Responding to challenge for oci.adosakana.local authorization...
15
+ Cleaning challenge tokens...
16
+ Requesting certificate...
17
+ Checking certificate...
19
+ Creating fullchain.pem...
SSL証明書は /usr/local/etc/dehydrated/certs/FQDN名ディレクトリ に作成されます。
nginx側の設定はMozilla SSL Configuration Generator を元に /etc/nginx/conf.d/default.conf を書き換えます。
1
# generated 2020-06-26, Mozilla Guideline v5.4, nginx 1.17.7, OpenSSL 1.0.1e, intermediate configuration, no OCSP
4
listen 80 default_server;
5
listen [::]:80 default_server;
7
location ^~ /.well-known/acme-challenge {
8
alias /var/www/dehydrated;
10
return 301 https:// $host$request_uri;
15
listen [::]:443 ssl http2;
17
ssl_certificate /usr/local/etc/dehydrated/certs/FQDN名ディレクトリ/fullchain.pem;
18
ssl_certificate_key /usr/local/etc/dehydrated/certs/FQDN名ディレクトリ/privkey.pem;
19
ssl_session_timeout 1d;
20
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
23
ssl_dhparam /usr/local/etc/dehydrated/certs/dhparam;
25
# intermediate configuration
26
ssl_protocols TLSv1.2;
27
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
28
ssl_prefer_server_ciphers off;
30
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
31
add_header Strict-Transport-Security "max-age=63072000" always;
Mozilla的にはffdhe2048.txtの配置を推奨するようなので、下記でダウンロードして配置します。
2
% Total % Received % Xferd Average Speed Time Time Time Current
3
Dload Upload Total Spent Left Speed
4
100 423 100 423 0 0 680 0 --:--:-- --:--:-- --:--:-- 681
そして、nginxを再起動します。
1
# systemctl restart nginx
ブラウザからhttpアクセスすると、httpsアクセスに変換された上で404 Not Found表示となることを確認します。
Let’s のSSL証明書は定期的に更新処理を実行する必要があります。
/etc/cron.d/dehydrated に下記の内容のファイルを作成します。(EPEL収録のdehydratedパッケージの内容を参考にした)
1
45 1 * * 4 root test -s /usr/local/etc/dehydrated/domains.txt && /usr/local/sbin/dehydrated --cron
WordPress設定
/var/www/html/wordpress にtar.gzの中身を展開
4
-rw-r--r--. 1 root root 12238031 Jun 11 06:49 latest.tar.gz
5
drwxr-xr-x. 5 nobody nfsnobody 4096 Jun 11 06:48 wordpress
6
# chown -R apache:apache wordpress/
9
-rw-r--r--. 1 root root 12238031 Jun 11 06:49 latest.tar.gz
10
drwxr-xr-x. 5 apache apache 4096 Jun 11 06:48 wordpress
WordPress用のnginx設定は「nginx WordPress recipe 」 を参考に作成した。元はphp-cgiを使用していたが、php-cgiパッケージはないためphp-fpm使用に切り替えている。
1
# Upstream to abstract backend connection(s) for php
3
server unix:/tmp/php-fpm.socket;
7
# generated 2020-06-26, Mozilla Guideline v5.4, nginx 1.17.7, OpenSSL 1.0.1e, intermediate configuration, no OCSP
10
listen 80 default_server;
11
listen [::]:80 default_server;
13
location ^~ /.well-known/acme-challenge {
14
alias /var/www/dehydrated;
16
return 301 https:// $host$request_uri;
21
listen [::]:443 ssl http2;
23
ssl_certificate /usr/local/etc/dehydrated/certs/FQDN名ディレクトリ/fullchain.pem;
24
ssl_certificate_key /usr/local/etc/dehydrated/certs/FQDN名ディレクトリ/privkey.pem;
25
ssl_session_timeout 1d;
26
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
29
ssl_dhparam /usr/local/etc/dehydrated/certs/dhparam;
31
# intermediate configuration
32
ssl_protocols TLSv1.2;
33
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
34
ssl_prefer_server_ciphers off;
36
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
37
add_header Strict-Transport-Security "max-age=63072000" always;
39
root /var/www/html/wordpress;
42
location = /favicon.ico {
46
location = /robots.txt {
52
try_files $uri $uri/ /index.php?$args;
55
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
56
include fastcgi_params;
57
fastcgi_intercept_errors on;
59
#The following parameter can be also included in fastcgi_params file
60
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
62
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
phpにMySQLアクセス用パッケージを入れていなかった・・・
またphpの日本語処理に必要なやつもなかったので「yum install php-mysql php-mbstring」でインストールして、php-fpmを再起動
1
# yum install php-mysql php-mbstring
3
--> Finished Dependency Resolution
7
================================================================================
8
Package Arch Version Repository Size
9
================================================================================
11
php-mbstring x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 497 k
12
php-mysqlnd x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 228 k
13
Installing for dependencies:
14
php-pdo x86_64 7.4.7-1.0.1.el7 ol7_developer_php74 121 k
17
================================================================================
18
Install 2 Packages (+1 Dependent package)
20
Total download size: 845 k
24
# systemctl restart php-fpm.service
成功
wp-config.php については手動で/var/www/html/wordpress/wp-config.php に作成する必要があったが、それ以外は問題無く実行された。
また、Wordpress上のプラグインインストールや更新についても特に問題なく実行できた。
2020/06/30追記
WordPressのAMPプラグインを動かそうとしたら「dom」が有効にできない、と言われた。
これはphp-xmlに含まれるので「yum install php-xml」で追加したあと「systemctl restart php-fpm.service」を実行した。
2020/07/14追記
wordpressのインポートを行おうとしたらファイルが大きくて「413 Request Entity Too Large」とエラーになった。
まず、 /etc/php.ini の「post_max_size」と「upload_max_filesize」の値を変更して、「systemctl restart php-fpm」を実行
1
; Maximum size of POST data that PHP will accept.
2
; Its value may be 0 to disable the limit. It is ignored if POST data reading
3
; is disabled through enable_post_data_reading.
1
; Maximum allowed size for uploaded files.
3
;upload_max_filesize = 2M
4
upload_max_filesize = 20M
また、「/etc/nginx/conf.d/default.conf」のポート443に関するserver定義内で「client_max_body_size」の設定を追加し、「systemctl restart nginx」で再起動します。
3
listen [::]:443 ssl http2;
5
client_max_body_size 20M;
これでアップロードが成功するようになりました。