{"id":1436,"date":"2018-12-24T21:45:22","date_gmt":"2018-12-24T12:45:22","guid":{"rendered":"https:\/\/test.ji0vwl.net\/?p=1436"},"modified":"2019-01-07T21:32:15","modified_gmt":"2019-01-07T12:32:15","slug":"lightsail-%e3%81%abwordpress%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b%ef%bc%88%e3%81%9d%e3%81%ae2%ef%bc%89","status":"publish","type":"post","link":"https:\/\/ji0vwl.net\/index.php\/2018\/12\/24\/1436\/","title":{"rendered":"Lightsail \u306bWordPress\u3092\u5165\u308c\u308b\uff08\u305d\u306e2\uff09"},"content":{"rendered":"<p>\u7d9a\u3044\u3066SSH\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001\u30ac\u30b7\u30ac\u30b7\u3068\u5165\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u6a19\u6e96\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u306eyum\u3060\u3068\u53e4\u3044\u3082\u306e\u3057\u304b\u5165\u3089\u306a\u3044\u306e\u3067\u3001\u666e\u901a\u306b\u5165\u308c\u3066\u3057\u307e\u3046\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>Linux OS: CentOS 7.6.1810<br \/>\nWeb\u30b5\u30fc\u30d0: Apache 2.4.6<br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9: MariaDB 5.5.60<br \/>\nPHP: PHP 5.4.16<br \/>\nWordPress: WordPress 4.9.8<\/p>\n<p>\u3053\u3053\u3067\u306f\u3001remi\u30ea\u30dd\u30b8\u30c8\u30ea\u306a\u3069\u306e\u62e1\u5f35\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089yum\u3067\u5165\u308c\u308b\u65b9\u6cd5\u3092\u3068\u3063\u3066\u3001\u6700\u65b0\u3067\u306f\u306a\u3044\u3067\u3059\u304c\u5c11\u3057\u3067\u3082\u65b0\u3057\u3044\u3082\u306e\u3092\u5165\u308c\u3066\u307f\u307e\u3059\u3002<\/p>\n<h5>1. SSH\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001epel\u30ea\u30dd\u30b8\u30c8\u30ea\u3001remi\u30ea\u30dd\u30b8\u30c8\u30ea\u3001ius\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h5>\n<pre>$ ssh ji0vwl-aws \uff08config\u3067\u8a2d\u5b9a\u6e08\u307f\u306e\u524d\u63d0\uff09\r\n\r\n$ sudo -i\r\n# timedatectl set-timezone Asia\/Tokyo\r\n# yum -y update\r\n# yum -y install epel-release\r\n# yum -y install \"http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-7.rpm\"\r\n# yum -y install \"https:\/\/centos7.iuscommunity.org\/ius-release.rpm\"\r\n# yum -y install mailcap git wget net-tools bind-utils\r\n<\/pre>\n<h5>2. Apache2.4.35\u3001mod_ssl\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u8a2d\u5b9a<\/h5>\n<pre># systemctl stop httpd\r\n# yum remove httpd\r\n# yum remove httpd-tools\r\n# yum --disablerepo=base,extras,updates --enablerepo=ius -y install httpd\r\n# yum -y install openldap-devel expat-devel\r\n# yum --disablerepo=base,extras,updates --enablerepo=ius -y install mod_ssl\r\n# mv \/etc\/httpd\/conf.d\/welcome.conf \/etc\/httpd\/conf.d\/welcome.conf.old\r\n<\/pre>\n<pre># vi \/var\/www\/html\/index.html\r\n-----------------------\r\n&lt;h1&gt;ji0vwl.net&lt;\/h1&gt;\r\n-----------------------\r\n:wq<\/pre>\n<pre># chown -R apache:apache \/var\/www\/html\r\n# chmod -R 755 \/var\/www\/html\r\n# setenforce 0\r\n# vi \/etc\/selinux\/config\r\n-----------------------\r\n...\r\nSELINUX=permissive\r\n...\r\n-----------------------\r\n:wq\r\n<\/pre>\n<p>HTTP\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306e\u8a2d\u5b9a<\/p>\n<pre># vi \/etc\/httpd\/conf.d\/vhost-http.conf\r\n-----------------------\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/var\/www\/html\r\n  ServerName ji0vwl.net\r\n\r\n  &lt;Directory \"\/var\/www\/html\/\"&gt;\r\n    Options FollowSymlinks Includes\r\n    AllowOverride All\r\n    AddType text\/html .html\r\n    Require all granted\r\n  &lt;\/Directory&gt;\r\n\r\n  # HTTP -&gt; HTTPS \u30ea\u30e9\u30a4\u30c8\u3059\u308b\u3068\u304d\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u89e3\u9664\r\n  #RewriteEngine on\r\n  #RewriteCond %{SERVER_NAME} =ji0vwl.net\r\n  #RewriteRule ^ https:\/\/%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]\r\n&lt;\/VirtualHost&gt;\r\n-----------------------\r\n:wq\r\n<\/pre>\n<pre># systemctl start httpd.service\r\n# systemctl enable httpd.service\r\n<\/pre>\n<h5>3. Let&#8217;s Encrypt\u3067SSL\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3001HTTPS\u8a2d\u5b9a<\/h5>\n<p>Let&#8217;s Encrypt\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre># yum -y install certbot python-certbot-apache\r\n# certbot\r\n...\r\n<\/pre>\n<p>HTTPS\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306e\u8a2d\u5b9a<\/p>\n<pre># vi \/etc\/httpd\/conf.d\/vhost-https.conf\r\n-----------------------\r\n&lt;IfModule mod_ssl.c&gt;\r\n&lt;VirtualHost *:443&gt;\r\n  DocumentRoot \/var\/www\/html\r\n  ServerName ji0vwl.net\r\n\r\n    &lt;Directory \"\/var\/www\/html\/\"&gt;\r\n        Options FollowSymlinks Includes\r\n        AllowOverride All\r\n        AddType text\/html .html\r\n        Require all granted\r\n    &lt;\/Directory&gt;\r\n  \r\n  # Let's Encrypt \u8a3c\u660e\u66f8\r\n  Include \/etc\/letsencrypt\/options-ssl-apache.conf\r\n  SSLCertificateFile \/etc\/letsencrypt\/live\/ji0vwl.net\/cert.pem\r\n  SSLCertificateKeyFile \/etc\/letsencrypt\/live\/ji0vwl.net\/privkey.pem\r\n  SSLCertificateChainFile \/etc\/letsencrypt\/live\/ji0vwl.net\/chain.pem\r\n&lt;\/VirtualHost&gt;\r\n&lt;\/IfModule&gt;\r\n-----------------------\r\n:wq\r\n<\/pre>\n<h5>4. PHP7.3.00\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h5>\n<pre># yum -y --enablerepo=epel install libmcrypt\r\n# yum -y remove php-*\r\n# yum -y install --enablerepo=remi,remi-php73 php php-devel php-mbstring php-pdo php-gd php-xml php-mysql php-opcache php-pecl-apcu\r\n# yum -y install php73-php-fpm\r\n# systemctl start php73-php-fpm\r\n# systemctl enable php73-php-fpm\r\n<\/pre>\n<h5>5. mariaDB 10.3.11\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u8a2d\u5b9a<\/h5>\n<pre># curl -sS https:\/\/downloads.mariadb.com\/MariaDB\/mariadb_repo_setup | sudo bash\r\n# yum -y install MariaDB-server MariaDB-client\r\n# systemctl start mariadb\r\n# systemctl enable mariadb\r\n<\/pre>\n<pre># mysql -u root\r\n&gt; update mysql.user set password=password('root\u30d1\u30b9\u30ef\u30fc\u30c9\u5165\u529b') where # user = 'root';\r\n&gt; flush privileges;\r\n&gt; exit;\r\n<\/pre>\n<p>WordPress\u7528DB,User,Password\u4f5c\u6210<\/p>\n<pre># mysql -u root -p\r\n&gt; CREATE DATABASE wordpress_db DEFAULT CHARACTER SET UTF8 DEFAULT COLLATE UTF8_GENERAL_CI;\r\n&gt; CREATE USER 'wordpress_ur'@'localhost' IDENTIFIED BY 'wp\u7528\u30d1\u30b9\u30ef\u30fc\u30c9\u5165\u529b';\r\n&gt; GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_ur'@'localhost';\r\n&gt; exit;\r\n<\/pre>\n<h5>6. WordPress4.9.8 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u8a2d\u5b9a<\/h5>\n<pre># cd \/var\/www\/\r\n# wget https:\/\/ja.wordpress.org\/wordpress-4.9.8-ja.tar.gz\r\n# tar zxvf wordpress-4.9.8-ja.tar.gz\r\n# mv html\/ html_old\r\n# mv wordpress html\r\n# chown -R apache:apache html\r\n# chmod -R 755 html\r\n# cd html\r\n<\/pre>\n<pre># cp wp-config-sample.php wp-config.php\r\n# vi wp-config.php\r\n-----------------------\r\n...\r\n\/** WordPress \u306e\u305f\u3081\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d *\/\r\ndefine('DB_NAME', 'wordpress_db');\r\n\r\n\/** MySQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30e6\u30fc\u30b6\u30fc\u540d *\/\r\ndefine('DB_USER', 'wordpress_ur');\r\n\r\n\/** MySQL \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d1\u30b9\u30ef\u30fc\u30c9 *\/\r\ndefine('DB_PASSWORD', 'wp\u7528\u30d1\u30b9\u30ef\u30fc\u30c9');\r\n\r\n\/** MySQL \u306e\u30db\u30b9\u30c8\u540d *\/\r\ndefine('DB_HOST', 'localhost');\r\n\r\n\/** \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u969b\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u6587\u5b57\u30bb\u30c3\u30c8 *\/\r\ndefine('DB_CHARSET', 'utf8');\r\n\r\n\/** \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u7167\u5408\u9806\u5e8f (\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u5909\u66f4\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093) *\/\r\ndefine('DB_COLLATE', '');\r\n\r\n\/* HTTPS\u5316\u3059\u308b\u306b\u306f\u3053\u308c\u3092\u8ffd\u8a18\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b*\/\r\n$_SERVER['HTTPS'] = 'on';\r\n...\r\n-----------------------\r\n:wq\r\n<\/pre>\n<pre># systemctl restart httpd.service\r\n<\/pre>\n<h5>7. \u30e1\u30e2\u30ea\u4e0d\u8db3\u3092\u89e3\u6d88\u3059\u308b\u305f\u3081\u306b\u30b9\u30ef\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210<\/h5>\n<pre># dd if=\/dev\/zero of=\/swapfile bs=1M count=2048\r\n# mkswap \/swapfile\r\n# swapon \/swapfile\r\n# chmod 600 \/swapfile\r\n<\/pre>\n<pre># vi \/etc\/fstab\r\n-----------------------\r\n...\r\n\/swapfile               swap                    swap    defaults        0 0\r\n...\r\n-----------------------\r\n:wq\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u3046\u307e\u304f\u52d5\u304b\u306a\u304f\u3066\u3001\u4f55\u5ea6\u3082\u6d88\u3057\u305f\u308a\u5165\u308c\u305f\u308a\u3057\u305f\u306e\u3067\u4e0a\u8a18\u306e\u901a\u308a\u3067\u5b8c\u74a7\u306b\u52d5\u304b\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u6700\u7d42\u7684\u306b\u306f\u4ee5\u4e0b\u306e\u74b0\u5883\u304c\u5165\u308a\u3001\u3053\u306eBlog\u30b5\u30fc\u30d0\u30fc\u304c\u7a3c\u50cd\u3092\u958b\u59cb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Linux OS: CentOS 7.6.1810<br \/>\nWeb\u30b5\u30fc\u30d0: Apache 2.4.6 \u2192 <strong>2.4.35<\/strong><br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9: MariaDB 5.5.60 \u2192\u00a0<strong>10.3.11<\/strong><br \/>\nPHP: PHP 5.4.16 \u2192 <strong>7.3.00<\/strong><br \/>\nWordPress: WordPress 4.9.8 \u2192 5.0.2\uff08\u81ea\u52d5\u66f4\u65b0\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d9a\u3044\u3066SSH\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001\u30ac\u30b7\u30ac\u30b7\u3068\u5165\u308c\u3066\u3044\u304d\u307e\u3059\u3002 \u6a19\u6e96\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u306eyum\u3060\u3068\u53e4\u3044\u3082\u306e\u3057\u304b\u5165\u3089\u306a\u3044\u306e\u3067\u3001\u666e\u901a\u306b\u5165\u308c\u3066\u3057\u307e\u3046\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002 Linux OS: CentOS 7.6.1810 Web &hellip; <a href=\"https:\/\/ji0vwl.net\/index.php\/2018\/12\/24\/1436\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Lightsail \u306bWordPress\u3092\u5165\u308c\u308b\uff08\u305d\u306e2\uff09<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1436","post","type-post","status-publish","format-standard","hentry","category-server"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/1436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/comments?post=1436"}],"version-history":[{"count":0,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/1436\/revisions"}],"wp:attachment":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/media?parent=1436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/categories?post=1436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/tags?post=1436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}