{"id":646,"date":"2022-07-20T04:33:00","date_gmt":"2022-07-20T11:33:00","guid":{"rendered":"https:\/\/jasonsblog.access.ly\/?p=646"},"modified":"2022-11-07T14:14:23","modified_gmt":"2022-11-07T21:14:23","slug":"run-your-own-wordpress-site-in-docker-with-nginx-proxy-manager-on-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/jasonsblog.ddns.net\/index.php\/2022\/07\/20\/run-your-own-wordpress-site-in-docker-with-nginx-proxy-manager-on-a-raspberry-pi\/","title":{"rendered":"Run your own WordPress site in Docker with Nginx Proxy Manager on a Raspberry Pi"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">WordPress is an easy way to create your own blogging site and with the addition of <a aria-label=\"Nginx Proxy Manager (opens in a new tab)\" href=\"https:\/\/nginxproxymanager.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Nginx Proxy Manager<\/a> you can easily manage your SSL certificates. And WordPress is a powerful platform for webpage creation and used by many web developers beyond blogging to business and eCommerce sites. There are a ton of themes and plugins available, so you can tailor the web experience to cover any need. And you can even edit the actual code of the site, but I find the Gutenberg built in editor to be pretty easy to use and more than sufficient. So why use a social media platform that censors content and manipulates it&#8217;s users by what content they push when you can run your own site on hardware as simple as a Raspberry Pi, a Raspberry Pi 3 in my case. After all, this was the revolution that was the internet, anyone can self post content whether blogs, news, audio podcasts, video content&#8230; And you just might find you enjoy the exercise of making your own content and exploring topics as writing forces you to organize your thoughts and understand things just a bit more. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I covered how to install docker in my <a href=\"https:\/\/jasonsblog.ddns.net\/index.php\/2022\/03\/17\/run-pi-hole-with-unbound-in-docker-on-a-raspberry-pi\/\" target=\"_blank\" rel=\"noreferrer noopener\">post on running Pi-Hole and Unbound<\/a>, so we skip right to installing Nginx Proxy Manager. You&#8217;ll need to create the network in docker (I&#8217;ll assume you can use an editor and update the files):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker network create nginxproxymanager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then create a directory nginxproxymanager to hold your docker-compose.yml file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ngingxproxymanager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then create your docker-compose.yml file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3'\nservices:\n  app:\n    image: 'jc21\/nginx-proxy-manager:latest'\n    restart: unless-stopped\n    ports:\n      - '80:80'\n      - '81:81'\n      - '443:443'\n    volumes:\n      - .\/data:\/data\n      - .\/letsencrypt:\/etc\/letsencrypt\nnetworks:\n      default:\n        external:\n          name: nginxproxymanager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can start your instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And you can access Nginx Proxy Manager via your browser, ip:81. You&#8217;ll have to set up your login and password. But before we set up your site and SSL certificate, we&#8217;ll need to create our WordPress site and database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create ~\/wordpress directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/wordpress\ncd ~\/wordpress<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create your docker-compose.yml file and update the login and passwords:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.1'\n\nservices:\n\n  wordpress:\n    image: wordpress\n    restart: always\n    #ports:\n    # - 80:80\n    environment:\n      WORDPRESS_DB_HOST: db\n      WORDPRESS_DB_USER: login\n      WORDPRESS_DB_PASSWORD: password\n      WORDPRESS_DB_NAME: wpdb\n    volumes:\n      - wordpress:\/var\/www\/html\n\n  db:\n    image: jsurf\/rpi-mariadb\n    restart: always\n    environment:\n      MYSQL_DATABASE:  wpdb\n      MYSQL_USER: login\n      MYSQL_PASSWORD: password\n      MYSQL_RANDOM_ROOT_PASSWORD: root_password\n    volumes:\n      - db:\/var\/lib\/mysql\n\nvolumes:\n  wordpress:\n  db:\nnetworks:\n      default:\n        external:\n          name: nginxproxymanager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can run your WordPress and database instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once running you can find the name of your WordPress instance in docker:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"171\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1-1024x171.png\" alt=\"\" class=\"wp-image-1937\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1-1024x171.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1-300x50.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1-768x128.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1-1536x256.png 1536w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-51-58-1.png 1543w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In my case my WordPress instance is wordpress_wordpress_1 which I&#8217;ll use to add in Nginx Proxy Manager as a host. And don&#8217;t forget to open port 80 in your router and point it to your Raspberry Pi where you&#8217;re installing WordPress. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"493\" height=\"542\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-55-11-1.png\" alt=\"\" class=\"wp-image-1939\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-55-11-1.png 493w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-55-11-1-273x300.png 273w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then you&#8217;ll go to the SSL tab and add new SSL certificate and select Let&#8217;s Encrypt which gives free SSL certificates. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"489\" height=\"517\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-57-57-1.png\" alt=\"\" class=\"wp-image-1940\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-57-57-1.png 489w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-09-57-57-1-284x300.png 284w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll add your domain name and test the server reachability, agree to the terms of service and hit save and Nginx Proxy Manager will get your new certificate. Mine is already set up, so I get a warning message above. If you don&#8217;t have a domain you can go the free route and get one from a dynamic DNS provider like noip.com. And usually your router will have some capacity to update the IP when changed or you can run a client on the machine.  And to get started with WordPress go to https:\/\/yourdomain\/wp-admin\/ and WordPress will walk you through setting up your account and after you&#8217;ll come out to your dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"672\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-10-11-31-1-1024x672.png\" alt=\"\" class=\"wp-image-1941\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-10-11-31-1-1024x672.png 1024w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-10-11-31-1-300x197.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-10-11-31-1-768x504.png 768w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-at-2022-07-20-10-11-31-1.png 1321w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Using WordPress has a bit of a learning curve, but below is a list to the WordPress documentation. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/codex.wordpress.org\/Getting_Started_with_WordPress\">https:\/\/codex.wordpress.org\/Getting_Started_with_WordPress<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So with Docker it couldn&#8217;t be easier to get a WordPress site running on even a Raspberry Pi, and Docker gives you isolation and containerization of the instance as it is publicly accessible to the internet. But with anything, you&#8217;ll want to keep the instance up to date and your WordPress dashboard will help with showing you when updates are available for themes and plugins as well as the WordPress installation itself (you can have themes and plugins auto update). I like to run this command on my docker installs daily to pull any new images:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you see it pull down a new WordPress, MariaDB or Nginx Proxy Manager image you can go into your related directory and rerun:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And after you can use the Docker CLI command to remove old images or make it easier and use <a href=\"https:\/\/jasonsblog.access.ly\/index.php\/2022\/03\/20\/manage-docker-with-portainer\/\" target=\"_blank\" aria-label=\"Portainer (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Portainer<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my case I&#8217;ve disabled comments as life is too short to deal with the &#8220;woke&#8221; people caught up in the &#8220;<a aria-label=\"Mass Formation (opens in a new tab)\" href=\"https:\/\/medium.com\/@dina.osman\/what-is-mass-formation-d2ac63020a34\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Mass Formation<\/a>&#8221; and all the emotional noise they generate, but feel free to have a more social site and enjoy your very own WordPress blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress is an easy way to create your own blogging site and with the addition of Nginx Proxy Manager you can easily manage your SSL certificates. And WordPress is a powerful platform for webpage creation and used by many web developers beyond blogging to business and eCommerce sites. There are a ton of themes and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-tech"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"featured_image_src":null,"author_info":{"display_name":"Jason","author_link":"https:\/\/jasonsblog.ddns.net\/index.php\/author\/jturning\/"},"_links":{"self":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=646"}],"version-history":[{"count":19,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":2108,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/646\/revisions\/2108"}],"wp:attachment":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/categories?post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/tags?post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}