{"id":96,"date":"2019-10-15T17:08:51","date_gmt":"2019-10-15T15:08:51","guid":{"rendered":"http:\/\/blog.remyblom.nl\/?p=96"},"modified":"2020-11-17T10:20:58","modified_gmt":"2020-11-17T09:20:58","slug":"installing-lemp-on-openbsd-6-5","status":"publish","type":"post","link":"https:\/\/blog.remyblom.nl\/?p=96","title":{"rendered":"Installing LEMP on OpenBSD 6.5"},"content":{"rendered":"\n<p>After <a href=\"https:\/\/blog.remyblom.nl\/?p=70\">installing<\/a> and <a href=\"https:\/\/blog.remyblom.nl\/?p=79\">hardening<\/a> my OpenBSD box it&#8217;s time to get some action done. Let&#8217;s get that LEMP stack, or rather the OHMP stack, because I am going to use OpenBSD&#8217;s httpd, MariaDB and PHP-FPM. And when I am ready I am going to install TLS certificates with Let&#8217;s Encrypt&#8217;s <code>certbot<\/code>.<\/p>\n\n\n\n<p><em>I used this <\/em><a href=\"http:\/\/www.h-i-r.net\/p\/setting-up-openbsd-relayd-based-httpd.html?m=1\"><em>tutorial on h-i-r.net about setting up OHMP<\/em><\/a><em> to get a bit more understanding about what was needed. Thanx Ax0n!<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Let&#8217;s GO!<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ doas pkg_add php-mysqli mariadb-server<\/code><\/pre>\n\n\n\n<p>This will get all the needed packages. Configure MariaDB and enable php-mysqli:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ doas \/usr\/local\/bin\/mysql_install_db\n$ doas rcctl start mysqld\n$ doas \/usr\/local\/bin\/mysql_secure_installation\n$ doas ln -sf \/etc\/php-7.3.sample\/mysqli.ini \/etc\/php-7.3\/mysqli.ini<\/code><\/pre>\n\n\n\n<p>Create <code>\/etc\/httpd.conf<\/code> and put in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>types { include \"\/usr\/share\/misc\/mime.types\" }\n\nserver \"default\" {\n  listen on * port 80\n  root \"\/htdocs\" \n  directory { index \"index.php\" }\n  location \"\/*.php*\" {\n    fastcgi socket \"\/run\/php-fpm.sock\"\n  }\n}<\/code><\/pre>\n\n\n\n<p>And make sure everything is enabled and start at reboot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ doas rcctl enable httpd\n$ doas rcctl enable php73_fpm\n$ doas rcctl enable mysqld\n$ doas reboot<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the stack<\/h2>\n\n\n\n<p>Download phpmyadmin into <code>\/var\/www\/htdocs\/phpmyadmin<\/code>. Make sure to set <code>$cfg['Servers'][$i]['host']<\/code> to <code>127.0.0.1<\/code> in the <code>config.ini.php<\/code> file so it will try to connect over TCP instead of using a socket. And verify that you can use php to access mysql. When logged in with phpMyAdmin you should follow the warnings it will give you to finalize your installation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ doas pkg_add php-curl\n$ doas ln -sf \/etc\/php-7.3.sample\/curl.ini \/etc\/php-7.3\n$ doas rcctl restart php73_fpm\n$ doas chmod -R 777 \/var\/www\/htdocs\/phpmyadmin\/tmp<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Ready!<\/h2>\n\n\n\n<p>Now in theory you have your OHMP stack right there. You could install WordPress and run your own blog, for instance! But I have other plans with this machine, I want it to <a href=\"https:\/\/blog.remyblom.nl\/?p=115\">run multiple domains and subdomains, and I want to run them under https<\/a>. So let&#8217;s go to the next chapter&#8230; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>After installing and hardening my OpenBSD box it&#8217;s time to get some action done. Let&#8217;s get that LEMP stack, or rather the OHMP stack, because I am going to use OpenBSD&#8217;s httpd, MariaDB and PHP-FPM. And when I am ready I am going to install TLS certificates with Let&#8217;s Encrypt&#8217;s certbot. I used this tutorial &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.remyblom.nl\/?p=96\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Installing LEMP on OpenBSD 6.5&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4,2],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-lemp","category-openbsd","category-vps"],"_links":{"self":[{"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":8,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":131,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions\/131"}],"wp:attachment":[{"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.remyblom.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}