{"id":478,"date":"2016-04-18T23:02:40","date_gmt":"2016-04-18T15:02:40","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=478"},"modified":"2018-09-04T23:20:17","modified_gmt":"2018-09-04T15:20:17","slug":"setting-up-a-lemp-web-server-on-raspberry-pi-3-with-an-ubuntu-server-15-10-3-image-to-host-a-wordpress-website","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/setting-up-a-lemp-web-server-on-raspberry-pi-3-with-an-ubuntu-server-15-10-3-image-to-host-a-wordpress-website\/","title":{"rendered":"Setting up a LEMP web server on Raspberry Pi 3 with an Ubuntu Server 15.10.3 image to host a WordPress website"},"content":{"rendered":"<p>I was trying to start a new WordPress site. Before hosting it on a <a href=\"https:\/\/m.do.co\/c\/68b7d9b94341\" title=\"Link to Digital Ocean\" target=\"_blank\">Digital Ocean<\/a> droplet, I decided to incubate the WordPress site on a <a href=\"http:\/\/www.amazon.com\/gp\/product\/B01CD5VC92?ie=UTF8&camp=1789&creativeASIN=B01CD5VC92&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Rasberry Pi 3 Model B Mother board\" target=\"_blank\">Raspberry Pi 3<\/a> to clock some content. This post documents the steps that I took to set up a <a href=\"https:\/\/www.techcoil.com\/lemp\/\" rel=\"noopener\" target=\"_blank\">LEMP<\/a> web server on Raspberry Pi 3 with an Ubuntu server 15.10.3 image to host a new WordPress site.<\/p>\n<h2>Getting the hardware that I need for my Raspberry Pi 3 LEMP web server<\/h2>\n<p>The hardware for this project is pretty straightforward - I got myself the following items:<\/p>\n<ol>\n<li>A <a href=\"http:\/\/www.amazon.com\/gp\/product\/B01CD5VC92?ie=UTF8&camp=1789&creativeASIN=B01CD5VC92&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Rasberry Pi 3 Model B Mother board\" target=\"_blank\">Raspberry Pi 3 motherboard<\/a><\/li>\n<li>A <a href=\"http:\/\/www.amazon.com\/gp\/product\/B0145IWUDW?ie=UTF8&camp=1789&creativeASIN=B0145IWUDW&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for PiBlox LEGO\u00ae Compatible Case For Raspberry Pi B+ \/ Raspberry Pi 2 - Black\" target=\"_blank\">PiBlox LEGO\u00ae Compatible Case<\/a><\/li>\n<li>A <a href=\"http:\/\/www.amazon.com\/gp\/product\/B010Q57T02?ie=UTF8&camp=1789&creativeASIN=B010Q57T02&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for SanDisk Ultra 32GB microSDHC UHS-I Card with Adapter \" target=\"_blank\">SanDisk Ultra 32GB microSDHC UHS-I Card with Adapter<\/a><\/li>\n<\/ol>\n<p>Since my laptop came with a SD card reader, I do not have to get a <a href=\"http:\/\/www.amazon.com\/gp\/product\/B00NNF4I5M?ie=UTF8&camp=1789&creativeASIN=B00NNF4I5M&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Insten USB 3.0 Super Speed All-in-1 Multi Card Reader \" target=\"_blank\">SD card reader<\/a>. <\/p>\n<h2>Getting the Ubuntu Server 15.10.3 image for my Raspberry Pi 3 onto the micro SD card<\/h2>\n<p>After I got the hardware that I need, the next step was to get the Ubuntu Server 15.10.3 image for my Raspberry Pi 3. The awesome folks at <a href=\"https:\/\/ubuntu-pi-flavour-maker.org\" title=\"Ubuntu pi flavour maker home page\" target=\"_blank\">Ubuntu Pi Flavour Maker<\/a> had made a few variations of Ubuntu images available for me to <a href=\"https:\/\/ubuntu-pi-flavour-maker.org\/download\/\" title=\"Ubuntu Pi Flavour maker download page for Raspberry Pi images \">download<\/a>. <\/p>\n<p>I downloaded a copy of the Ubuntu Server Standard 15.10.3 image onto my windows machine via torrent. <\/p>\n<p>Once I got the .xz file, I used <a href=\"http:\/\/www.7-zip.org\/download.html\" title=\"7-zip download page\" target=\"_blank\">7-zip<\/a> to extract the .img file. I then <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-prepare-the-operating-system-to-run-your-raspberry-pi-with-your-windows-machine\/\" target=\"_blank\">used Win32 Disk Imager to write the .img file<\/a> into the <a href=\"http:\/\/www.amazon.com\/gp\/product\/B010Q57T02?ie=UTF8&camp=1789&creativeASIN=B010Q57T02&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for SanDisk Ultra 32GB microSDHC UHS-I Card with Adapter \" target=\"_blank\">SanDisk microSD card<\/a> via the SD card drive on my laptop.<\/p>\n<h2>Booting into Ubuntu Server 15.10.3 on my Raspberry Pi 3<\/h2>\n<p>Once Win32 Disk Imager completed writing the Ubuntu Server 15.10.3 image onto my <a href=\"http:\/\/www.amazon.com\/gp\/product\/B010Q57T02?ie=UTF8&camp=1789&creativeASIN=B010Q57T02&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for SanDisk Ultra 32GB microSDHC UHS-I Card with Adapter \" target=\"_blank\">SanDisk microSD card<\/a>, I removed it from my SD card reader and inserted it to the SD card slot on the Raspberry Pi 3 motherboard. <strong>Note that unlike the Raspberry Pi 2, the microSD slot of the Raspberry Pi 3 motherboard is not a spring loaded one.<\/strong> This means that you just push to insert your microSD card and pull to remove your microSD card.<\/p>\n<p>I then attached my trusty <a href=\"http:\/\/www.amazon.com\/gp\/product\/B003B4BBFK?ie=UTF8&camp=1789&creativeASIN=B003B4BBFK&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Logitech M100 USB Optical Wired Mouse\" target=\"_blank\">mouse<\/a>, <a href=\"http:\/\/www.amazon.com\/gp\/product\/B004VVLZN0?ie=UTF8&camp=1789&creativeASIN=B004VVLZN0&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Logitech Classic Keyboard K100\" target=\"_blank\">keyboard<\/a>, <a href=\"http:\/\/www.amazon.com\/gp\/product\/B00M2UIWKQ?ie=UTF8&camp=1789&creativeASIN=B00M2UIWKQ&linkCode=xm2&tag=clivsperswebs-20\" title=\"Amazon page for Samsung Simple LED 24\" Monitor S24D300H with High Glossy Finish\" target=\"_blank\">monitor<\/a>, a RJ45 network cable from my DLink router and my old samsung charger to my Raspberry Pi 3 motherboard. After turning on the power, the login screen appears. The default username is <strong>ubuntu<\/strong> and the password is <strong>ubuntu<\/strong>.<\/p>\n<h2>Adding a new user<\/h2>\n<p>I do not like a default username for my web server, even though it is not going to be used as the production server. Hence, I first added a new user via the command as follows:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo adduser techcoil\r\n<\/pre>\n<p>I then went through the following Q and As:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nAdding user `techcoil' ...\r\nAdding new group `techcoil' (1000) ...\r\nAdding new user `techcoil' (1000) with group `techcoil' ...\r\nCreating home directory `\/home\/techcoil' ...\r\nCopying files from `\/etc\/skel' ...\r\nEnter new UNIX password: \r\nRetype new UNIX password: \r\npasswd: password updated successfully\r\nChanging the user information for techcoil\r\nEnter the new value, or press ENTER for the default\r\n\tFull Name &#x5B;]: Techcoil\r\n\tRoom Number &#x5B;]: #1234\r\n\tWork Phone &#x5B;]: 12345678\r\n\tHome Phone &#x5B;]: 12345678\r\n\tOther &#x5B;]: 12345678\r\n<\/pre>\n<p>After I had created my new user account, I proceeded to add it to the sudo group so that I was able to continue with installing the necessary software:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo adduser techcoil sudo\r\n<\/pre>\n<h2>Deleting the default user<\/h2>\n<p>Once I had created my user, I proceeded to delete the default user. <\/p>\n<p>I first restarted the server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo reboot\r\n<\/pre>\n<p>After the server booted up again, I logged in with my new user.<\/p>\n<p>I typed the following in the terminal to delete the default user:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo deluser --remove-home ubuntu\r\n<\/pre>\n<h2>Installing Nginx on my Ubuntu Server 15.10.3<\/h2>\n<p>I installed Nginx with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install nginx\r\n<\/pre>\n<p>After the installation had completed, I ran the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncurl -0 localhost\r\n<\/pre>\n<p>And got the following output:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Welcome to nginx!&lt;\/title&gt;\r\n&lt;style&gt;\r\n    body {\r\n        width: 35em;\r\n        margin: 0 auto;\r\n        font-family: Tahoma, Verdana, Arial, sans-serif;\r\n    }\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;Welcome to nginx!&lt;\/h1&gt;\r\n&lt;p&gt;If you see this page, the nginx web server is successfully installed and\r\nworking. Further configuration is required.&lt;\/p&gt;\r\n\r\n&lt;p&gt;For online documentation and support please refer to\r\n&lt;a href=&quot;http:\/\/nginx.org\/&quot;&gt;nginx.org&lt;\/a&gt;.&lt;br\/&gt;\r\nCommercial support is available at\r\n&lt;a href=&quot;http:\/\/nginx.com\/&quot;&gt;nginx.com&lt;\/a&gt;.&lt;\/p&gt;\r\n\r\n&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;\/em&gt;&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>This output assured me that my Nginx web server was successfully installed.<\/p>\n<h2>Installing the MySQL database server on my Ubuntu Server 15.10.3<\/h2>\n<p>I then proceeded to install the MySQL database server for my WordPress site.<\/p>\n<p>To do so, I typed the following in the terminal:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install mysql-server mysql-client\r\n<\/pre>\n<p>This led to the screen to enter a password for the root user:<br \/>\n<img decoding=\"async\" src=\"\/ph\/img\/blog\/posts\/password-screen-for-installing-mysql-server-on-ubuntu.png\" alt=\"Password screen for MySQL database root user\"\/><\/p>\n<p>And the screen to repeat the password for the root user:<br \/>\n<img decoding=\"async\" src=\"\/ph\/img\/blog\/posts\/repeat-password-screen-for-installing-mysql-server-on-ubuntu.png\" alt=\"Password screen for MySQL database root user\"\/><\/p>\n<p>I verified my MySQL database installation by entering the command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status mysql\r\n<\/pre>\n<p>Which produced the following output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf mysql.service - MySQL Community Server\r\n   Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2016-04-06 12:10:25 UTC; 15min ago\r\n Main PID: 4534 (mysqld_safe)\r\n   CGroup: \/system.slice\/mysql.service\r\n           \u251c\u25004534 \/bin\/sh \/usr\/bin\/mysqld_safe\r\n           \u2514\u25004881 \/usr\/sbin\/mysqld --basedir=\/usr --datadir=\/var\/lib\/mysql --...\r\n\r\nApr 06 12:10:23 ubuntu-standard systemd&#x5B;1]: Starting MySQL Community Server...\r\nApr 06 12:10:24 ubuntu-standard mysqld_safe&#x5B;4534]: 160406 12:10:24 mysqld_saf...\r\nApr 06 12:10:24 ubuntu-standard mysqld_safe&#x5B;4534]: 160406 12:10:24 mysqld_saf...\r\nApr 06 12:10:24 ubuntu-standard mysqld_safe&#x5B;4534]: 160406 12:10:24 mysqld_saf...\r\nApr 06 12:10:25 ubuntu-standard systemd&#x5B;1]: Started MySQL Community Server.\r\nHint: Some lines were ellipsized, use -l to show in full.\r\n<\/pre>\n<p>With that, I got myself a MySQL database server and a root account for the database related tasks later on. <\/p>\n<h2>Installing PHP<\/h2>\n<p>The final part of the LEMP stack was PHP. I would need to install, the PHP binary, the PHP Fast Process Manager and the PHP MySQL driver. To do so, I entered the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php5 php5-fpm php5-mysql\r\n<\/pre>\n<p>After the installation had completed, I entered the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status php5-fpm\r\n<\/pre>\n<p>And got the following verification:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf php5-fpm.service - The PHP FastCGI Process Manager\r\n   Loaded: loaded (\/lib\/systemd\/system\/php5-fpm.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2016-04-06 12:52:55 UTC; 4min 59s ago\r\n Main PID: 7300 (php5-fpm)\r\n   Status: &quot;Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req\/sec&quot;\r\n   CGroup: \/system.slice\/php5-fpm.service\r\n           \u251c\u25007300 php-fpm: master process (\/etc\/php5\/fpm\/php-fpm.conf)\r\n           \u251c\u25007302 php-fpm: pool www\r\n           \u2514\u25007303 php-fpm: pool www\r\n\r\nApr 06 12:52:55 ubuntu-standard systemd&#x5B;1]: Starting The PHP FastCGI Process....\r\nApr 06 12:52:55 ubuntu-standard systemd&#x5B;1]: Started The PHP FastCGI Process ....\r\nApr 06 12:52:58 ubuntu-standard systemd&#x5B;1]: Started The PHP FastCGI Process ....\r\nHint: Some lines were ellipsized, use -l to show in full.\r\n<\/pre>\n<h2>Getting a copy of WordPress<\/h2>\n<p>After I had installed the main pieces of the LEMP stack, I went on to get a copy of WordPress from the internet.  <\/p>\n<p>I got into the \/var\/www directory that was created when I installed the Nginx server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/var\/www\r\n<\/pre>\n<p>Once I got into that directory, I downloaded the latest WordPress files:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nwget https:\/\/wordpress.org\/latest.tar.gz\r\n<\/pre>\n<p>After the download had completed, I extracted the \"wordpress\" directory from the downloaded file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntar xvfz latest.tar.gz\r\n<\/pre>\n<p>When the \"wordpress\" directory had been extracted, I deleted the tar file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrm latest.tar.gz\r\n<\/pre>\n<p>I then changed the name of the \"wordpress\" directory to a name which I like:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mv wordpress my_new_wordpress_site\r\n<\/pre>\n<p>With that, my \"\/var\/www\" folder contained a directory named as \"my_new_wordpress_site\". This would be the folder which I configure Nginx to get PHP FPM to look into when serving HTTP requests directed at my new WordPress site.  <\/p>\n<h2>Configuring Nginx web server to serve HTTP requests for the WordPress site<\/h2>\n<p>It was relatively straightforward to configure the Nginx to serve HTTP requests for the WordPress site as WordPress provides a <a href=\"https:\/\/codex.wordpress.org\/Nginx\" title=\"WordPress guide on configuring Nginx\" target=\"_blank\">good guide<\/a> on doing so. <\/p>\n<h4>Creating the set of common files<\/h4>\n<p>I created a folder \"global\" inside of \"\/etc\/nginx\" folder:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mkdir \/etc\/nginx\/global\r\n<\/pre>\n<p>With the \"global\" directory created, I got into it:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/etc\/nginx\/global\r\n<\/pre>\n<p>Inside \"\/etc\/nginx\/global\", I created the global restriction rules inside the file: <strong>restrictions.conf<\/strong>, with the following contents:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# Global restrictions configuration file.\r\n# Designed to be included in any server {} block.\r\nlocation = \/favicon.ico {\r\n\tlog_not_found off;\r\n\taccess_log off;\r\n}\r\n\r\nlocation = \/robots.txt {\r\n\tallow all;\r\n\tlog_not_found off;\r\n\taccess_log off;\r\n}\r\n<\/pre>\n<p>I then created the general WordPress rules inside of <strong>wordpress.conf<\/strong>, with the following contents:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# WordPress single site rules.\r\n# Designed to be included in any server {} block.\r\n\r\n# This order might seem weird - this is attempted to match last if rules below fail.\r\n# http:\/\/wiki.nginx.org\/HttpCoreModule\r\nlocation \/ {\r\n\ttry_files $uri $uri\/ \/index.php?$args;\r\n}\r\n\r\n# Add trailing slash to *\/wp-admin requests.\r\nrewrite \/wp-admin$ $scheme:\/\/$host$uri\/ permanent;\r\n\r\n# Directives to send expires headers and turn off 404 error logging.\r\nlocation ~* ^.+\\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {\r\n       access_log off; log_not_found off; expires max;\r\n}\r\n\r\n# Uncomment one of the lines below for the appropriate caching plugin (if used).\r\n#include global\/wordpress-wp-super-cache.conf;\r\n#include global\/wordpress-w3-total-cache.conf;\r\n\r\n# Pass all .php files onto a php-fpm\/php-fcgi server.\r\nlocation ~ &#x5B;^\/]\\.php(\/|$) {\r\n\tfastcgi_split_path_info ^(.+?\\.php)(\/.*)$;\r\n\tif (!-f $document_root$fastcgi_script_name) {\r\n\t\treturn 404;\r\n\t}\r\n\t# This is a robust solution for path info security issue and works with &quot;cgi.fix_pathinfo = 1&quot; in \/etc\/php.ini (default)\r\n\r\n\tinclude fastcgi_params;\r\n\tfastcgi_index index.php;\r\n\tfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n#\tfastcgi_intercept_errors on;\r\n\tfastcgi_pass unix:\/var\/run\/php5-fpm.sock;\r\n}\r\n\r\n# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).\r\n# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)\r\nlocation ~ \/\\. {\r\n\tdeny all;\r\n}\r\n\r\n# Deny access to any files with a .php extension in the uploads directory\r\n# Works in sub-directory installs and also in multisite network\r\n# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)\r\nlocation ~* \/(?:uploads|files)\/.*\\.php$ {\r\n\tdeny all;\r\n}\r\n<\/pre>\n<h4>Creating the Nginx configuration rules for the new WordPress site<\/h4>\n<p>With the common files, <code>restrictions.conf<\/code> and <code>wordpress.conf<\/code>, created, I then went on to create the Nginx configurations that will tell Nginx how to serve HTTP requests directed at the domain name of my new WordPress site:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n\tlisten 80;\r\n\tserver_name anewwebsite.com www.anewwebsite.com;\r\n\troot \/var\/www\/my_new_wordpress_site;\r\n\r\n\tindex index.php;\r\n\r\n\tinclude global\/restrictions.conf;\r\n\r\n\t# Only include one of the files below.\r\n\tinclude global\/wordpress.conf;\r\n}\r\n<\/pre>\n<p>I saved this file as <code>anewwebsite.com.conf<\/code> and placed it in the <code>\/etc\/nginx\/sites-enabled<\/code> directory.<\/p>\n<p>After I was done with my Nginx settings, I restarted the Nginx server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx\r\n<\/pre>\n<h2>Creating a new MySQL user and a database instance for the WordPress site<\/h2>\n<p>The new WordPress site will need a new MySQL user to log into a database instance. To do so, I first login to the MySQL server with MySQL root user via the terminal:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql -u root -p\r\n<\/pre>\n<p>After keying the password for the MySQL root user, I created a database instance: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql&gt; CREATE DATABASE newWordPressDb;\r\n<\/pre>\n<p>After creating the new database instance successfully, I went on to create the MySQL user which could interact with newWordPressDb:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql&gt; CREATE USER 'anewuser'@'localhost' IDENTIFIED BY 'password';\r\nmysql&gt; GRANT ALL ON newWordPressDb.* TO 'anewuser'@'localhost';\r\n<\/pre>\n<p>With that, I would have a MySQL user that is able to interact with a database instance on behalf of my new WordPress site.<\/p>\n<h2>Creating the WordPress configurations to talk to the database instance<\/h2>\n<p>With the dependencies being configured, the final set of configurations that I needed to create was for WordPress to take. <\/p>\n<p>To begin with the configurations, I renamed <code>wp-config-sample.php<\/code> to <code>wp-config.php<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mv \/var\/www\/my_new_wordpress_site\/wp-config-sample.php \/var\/www\/my_new_wordpress_site\/wp-config.php\r\n<\/pre>\n<p>I then open up the <code>wp-config.php<\/code> file inside my WordPress installation directory, <code>\/var\/www\/my_new_wordpress_site<\/code>, and updated the sections that looked like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\r\n\/** The name of the database for WordPress *\/\r\ndefine('DB_NAME', 'newWordPressDb');\r\n\r\n\/** MySQL database username *\/\r\ndefine('DB_USER', 'anewuser');\r\n\r\n\/** MySQL database password *\/\r\ndefine('DB_PASSWORD', 'password');\r\n\r\n\/** MySQL hostname *\/\r\ndefine('DB_HOST', 'localhost');\r\n\r\n\/\/ .... Other settings ...\r\n\r\n\/\/ Generated from https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\r\ndefine('AUTH_KEY',         '9b{65l@weJn+4Svc;]pz9b6vB&#x5B;q-Py!&gt;L_;=wM&#x5B;trXTHyan+Suhq|w})9uvX4DKl');\r\ndefine('SECURE_AUTH_KEY',  '.J&amp; 4`BMG#L#)t-+8Lv$DPT3X.mg}^kY^E2x!Ow8n7}Z|!s4B#RTc`&lt;Ap]$~${%+');\r\ndefine('LOGGED_IN_KEY',    'DTo`gm+NE5ej6QB-5}+QOrk)B?SyR=PioYBLIo.Q_-|UjqhNvy]6y*@nDgs*F;68');\r\ndefine('NONCE_KEY',        '@2&lt;U|{md-l3`|^VV2&#x5B;S#i&amp;kH7|WF|qB%*kXCw||zVuvr&lt;$q3\/^,.+bRbSb){JLN7');\r\ndefine('AUTH_SALT',        ']_L90r+ NbL;m.&amp;Y&lt;&gt;^4 ^Jw-)H&amp;H18YrqBqOpeDA0i*Lb4|&amp;}a+yUUp9R2Zi3+!');\r\ndefine('SECURE_AUTH_SALT', 'm61%&lt;@s&gt;3+;k(4-,^bT:BMf*yYxyxVG+80WV=X\/f8GtI&gt;R^V+iE1GO@0XA%Sw_U{');\r\ndefine('LOGGED_IN_SALT',   '#F7SQ QhgviCMIFnBK~Z_J-TiV{Gj@|CjS|rM&#x5B;kIquM;v,ce&amp;Sk\/gn.X9kt1_&#x5B;*]');\r\ndefine('NONCE_SALT',       'HEpM&lt;urflJp(|~c`=-pt#C+M:f=R;rY\/E$_klu&#x5B;ly`J.Sc|P,pnyW.FaZ-|&gt;Pq]F');\r\n<\/pre>\n<p>Be sure to access <a href=\"https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\" title=\"WordPress secret keys generator\" target=\"_blank\">https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/<\/a> with your browser to get the values for the section starting from \"AUTH_KEY\" to \"NONCE_SALT\".<\/p>\n<h2>Editing the hosts file on my work computer so that I can direct HTTP requests for the new domain onto the Raspberry Pi 3 server<\/h2>\n<p>After creating the necessary configurations that allowed WordPress to talk to my MySQL server, I proceeded on to making my Windows machine direct HTTP requests for <strong>anewwebsite.com<\/strong> or <strong>www.anewwebsite.com <\/strong>over to my LEMP web server on Raspberry Pi 3.<\/p>\n<p>On my Raspberry Pi 3, I ran the following command to get the IP address of its <code>eth0<\/code> network interface:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nifconfig\r\n<\/pre>\n<p>With the IP address, 10.0.2.112, from the output, I went over to my Windows work machine and looked for the <code>hosts<\/code> file at the <code>C:\/Windows\/System32\/drivers\/etc\/<\/code> folder and added the following lines of configurations:<\/p>\n<p>10.0.2.112 anewwebsite.com<br \/>\n10.0.2.112 www.anewwebsite.com<\/p>\n<h2>Running the WordPress install script<\/h2>\n<p>After all the configurations were done, I typed 'www.anewwebsite.com' into the browser on my Windows work machine.<\/p>\n<p>With that, I was shown the following page:<\/p>\n<p><img decoding=\"async\" src=\"\/ph\/img\/blog\/posts\/wordpress-installation-process-screenshot.png\" alt=\"WordPress installation page screenshot\"\/><\/p>\n<p>After I filled up all the necessary fields and clicked on the \"Install WordPress\" button, I got the following screen:<\/p>\n<p><img decoding=\"async\" src=\"\/ph\/img\/blog\/posts\/wordpress-installation-process-successful-screenshot.png\" alt=\"WordPress installation successful page screenshot\"\/><\/p>\n<p>This page indicated that I had managed to set up a LEMP web server on Raspberry Pi 3 with an Ubuntu Server 15.10.3 image to host my new WordPress site.<\/p>\n<p>Clicking on the \"Log In\" button brought me to the login page where I could supply my username and password to begin creating my content.<\/p>\n<h2>Buying the Raspberry Pi 3 hardware to build your own LEMP web server<\/h2>\n<p>If you do not have the Raspberry Pi 3 hardware mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi 3 hardware to your cart. You may remove anything that you already have or replace some of the hardware with other hardware.<\/p>\n<p><center><\/p>\n<form action=\"https:\/\/www.amazon.com\/gp\/aws\/cart\/add.html\" method=\"GET\" target=\"_blank\"><input name=\"AssociateTag\" type=\"hidden\" value=\"clivsperswebs-20\"><input name=\"SubscriptionId\" type=\"hidden\" value=\"[AKIAIMND5UBCQU2HRSUA]\"><input name=\"ASIN.1\" type=\"hidden\" value=\"B01CD5VC92\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B0145IWUDW\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B010Q57T02\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><br \/>\n<input alt=\"Buy from Amazon.com\" name=\"add\" type=\"image\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/associates\/remote-buy-box\/buy4.gif\" value=\"Buy from Amazon.com\"><\/form>\n<p><\/center><\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-7I\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7I&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-7I&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F478&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p>I was trying to start a new WordPress site. Before hosting it on a <a href=\"https:\/\/m.do.co\/c\/68b7d9b94341\" title=\"Link to Digital Ocean\" target=\"_blank\">Digital Ocean<\/a> droplet, I decided to incubate the WordPress site on a <a href=\"http:\/\/www.amazon.com\/gp\/product\/B01CD5VC92?ie=UTF8&#038;camp=1789&#038;creativeASIN=B01CD5VC92&#038;linkCode=xm2&#038;tag=clivsperswebs-20\" title=\"Amazon page for Rasberry Pi 3 Model B Mother board\" target=\"_blank\">Raspberry Pi 3<\/a> to clock some content. This post documents the steps that I took to set up a <a href=\"https:\/\/www.techcoil.com\/lemp\/\" rel=\"noopener\" target=\"_blank\">LEMP<\/a> web server on Raspberry Pi 3 with an Ubuntu server 15.10.3 image to host a new WordPress site.<\/p>\n","protected":false},"author":1,"featured_media":1252,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[242,9,225,13,243,240,308,423,195,241,5],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/Raspberry-Pi-3-with-WordPress-logo-with-keyboard-on-wooden-floor-as-the-background.jpg","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-7I","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/478"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1252"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}