ワードプレス環境構築webサーバー編

OpenWrtでWordPressを構築した方法を備忘録として書いていきます。
大きく3つに別れます。
①Webサーバーuhttpdインストール
②データベースmariaDBインストール
③WordPressインストール
まずuhttpdはluciに使われているブラウザですが、luciを使わない方法です。luciを使いたい人は公式オリジナルサイト、かQiitaのサイトでどうぞ。
luci無しのsnapshotビルドをベースにします。
①uhttpdとSSLインストール
opkg update && opkg install uhttpd libuhttpd-mbedtls libustream-mbedtls px5g-mbedtls
/etc/uhttpd.crt
/etc/uhttpd.key
にOpenWrtの自己証明書が出来上がっているのでこれをLet’s Encryptの証明書と差し替えます。SSLなうが楽に取れます。DERに変換しなくて構いません。PEMで大丈夫です。
PHPモジュールインストールluciを使わないのでメインセクションにそのまま以下のように記述します。
/etc/config/uhttpd

# Server configuration
config uhttpd main
# HTTP listen addresses, multiple allowed
list listen_http 0.0.0.0:80
# list listen_http [::]:80
# HTTPS listen addresses, multiple allowed
list listen_https 0.0.0.0:443
# list listen_https [::]:443
# Redirect HTTP requests to HTTPS if possible
option redirect_https 1
# Server document root
option home /mnt/sda1/wordpress
option index_file 'index.php’
option index_page 'index.php’
list interpreter “.php=/usr/bin/php-cgi"

PHP関連パッケージ一覧は
opkg list | grep -e php7 で取得できます。

opkg install php7 php7-cgi php7-cli php7-fastcgi php7-mod-curl php7-mod-dom php7-mod-exif php7-mod-fileinfo php7-mod-json php7-mod-mbstring php7-mod-mysqli php7-mod-pdo php7-mod-pdo-mysql php7-mod-pdo-sqlite php7-mod-session php7-mod-xml php7-mod-simplexml php7-mod-gd php7-mod-opcache php7-mod-zip php7-mod-iconv php7-mod-filter php7-mod-bcmath php7-mod-xmlreader php7-mod-xmlwriter php7-mod-sockets php7-mod-ctype

/etc/php.ini

- doc_root = “/www"
+ doc_root = “/mnt/sda1/wordpress"

に変更します。
 
 
 
 
 
 
 
 
 
 
 

OpenWrt

Posted by taroumaru