{"id":791,"date":"2017-08-13T14:19:58","date_gmt":"2017-08-13T06:19:58","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=791"},"modified":"2018-07-11T13:06:16","modified_gmt":"2018-07-11T05:06:16","slug":"setting-up-projectsend-on-your-raspberry-pi-3-for-sharing-files-the-lemp-way","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/setting-up-projectsend-on-your-raspberry-pi-3-for-sharing-files-the-lemp-way\/","title":{"rendered":"Setting up ProjectSend on your Raspberry Pi 3 for sharing files &#8211; the LEMP way"},"content":{"rendered":"<p>Do you have large files that you want to share with your friends or clients? Do you keep your Internet connection on 24-7? <\/p>\n<p>Compared to using Google Drive, Dropbox or other on-the-cloud file sharing software, hosting your own file sharing software when you never switch off your Internet has a few advantages. <\/p>\n<p>Provided that your friends don't share your files with others, your files stay at home and on your friends' machines. Furthermore, you are only limited by the amount of storage that you have on your machine. <\/p>\n<p>If you have a Raspberry Pi 3 in your house, you may want to consider setting up <a href=\"http:\/\/www.projectsend.org\/\" target=\"_blank\">ProjectSend<\/a> on your <a href=\"https:\/\/techcoil.com\/blog\/tag\/raspberry-pi-3\" target=\"_blank\">Raspberry Pi 3<\/a> for sharing files with others. This post shows how to do it with a <a href=\"https:\/\/www.techcoil.com\/lemp\/\" rel=\"noopener\" target=\"_blank\">LEMP stack<\/a>.<\/p>\n<h2>Hardware recommendations for hosting ProjectSend<\/h2>\n<p>I recommend the following hardware for hosting ProjectSend:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B01CCPKCSK\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01CCPKCSK&linkId=64594d3221ff586b89a75314339caa52\" target=\"_blank\">Official Raspberry Pi 3 Case - Red\/White<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B01CD5VC92\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01CD5VC92&linkId=5e9e3f9b7a5f3d871801a9cb350be78c\" target=\"_blank\" data-amzn-asin=\"B01CD5VC92\">Raspberry PI 3 Model B A1.2GHz 64-bit quad-core ARMv8 CPU, 1GB RAM<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B010Q57S62\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B010Q57S62&linkId=78db975a8ac1afecc959afe3cff4f8c3\" target=\"_blank\">SanDisk Ultra 128GB microSDXC UHS-I Card with Adapter, Black, Standard Packaging (SDSQUNC-128G-GN6MA)<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B00MARDJZ4\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00MARDJZ4&linkId=dd34a2d599883d96b6cded12a8615724\" target=\"_blank\" data-amzn-asin=\"B00MARDJZ4\">CanaKit 5V 2.5A Raspberry Pi 3 Power Supply \/ Adapter \/ Charger (UL Listed)<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B00N2VISLW\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00N2VISLW&linkId=7f361c63b9853431b86543a604edefea\" target=\"_blank\">AmazonBasics RJ45 Cat-6 Ethernet Patch Cable - 3 Feet (0.9 Meters)<\/a><\/li>\n<\/ul>\n<p>If you had a spare micro USB charger that came along with your typical Android phone, you can use it to power your Raspberry Pi 3 instead of buying the <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00MARDJZ4\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00MARDJZ4&linkId=dd34a2d599883d96b6cded12a8615724\" target=\"_blank\" data-amzn-asin=\"B00MARDJZ4\">CanaKit 5V 2.5A Raspberry Pi 3 Power Supply \/ Adapter \/ Charger (UL Listed)<\/a>.<\/p>\n<h2>Prerequisite hardware to install operating system onto microSD<\/h2>\n<p>Raspberry Pi 3 board will load an operating system from a microSD card. Hence, we will need to have a computer with a SD card reader. If your computer does not come with a <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00NNF4I5M?ie=UTF8&camp=1789&creativeASIN=B00NNF4I5M&linkCode=xm2&tag=clivsperswebs-20\" target=\"_blank\">SD card reader<\/a>, you have to get one.  <\/p>\n<h2>Getting a copy of Raspbian Lite<\/h2>\n<p>Once we had gotten the hardware, we can then proceed to <a href=\"http:\/\/downloads.raspberrypi.org\/raspbian_lite\/images\/raspbian_lite-2017-07-05\/2017-07-05-raspbian-jessie-lite.zip\" target=\"_blank\">download a copy of Raspbian Jessie Lite<\/a>. The latest Raspbian operating system is available at <a href=\"https:\/\/www.raspberrypi.org\/downloads\/raspbian\/\" target=\"_blank\">https:\/\/www.raspberrypi.org\/downloads\/raspbian\/<\/a>. As of this writing, the one that was available was \"RASPBIAN JESSIE LITE\":<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/2017-07-13_raspbian-download-page.gif\" alt=\"2017-07-13 Raspbian download page\" \/><\/p>\n<p>Click on the <a href=\"https:\/\/downloads.raspberrypi.org\/raspbian_lite_latest\" target=\"_blank\">Download ZIP<\/a> button and save the file onto your file system. <\/p>\n<h2>Installing Raspbian Lite on the microSD card<\/h2>\n<p>Once you had gotten the <code>.zip<\/code> file in your computer, extract the <code>.img<\/code> file from the <code>.zip<\/code> file. The <code>.img<\/code> file is the operating system image that we will use for installing Raspbian Jessie Lite onto the microSD card.<\/p>\n<p>If you have a MacBook, you can <a href=\"https:\/\/www.techcoil.com\/blog\/an-easy-way-to-install-raspberry-pi-operating-system-on-a-mac\/\" target=\"_blank\">use Etcher to install the operating system image onto your microSD card<\/a>.<\/p>\n<p>If you are using a windows machine, you can <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-prepare-the-operating-system-to-run-your-raspberry-pi-with-your-windows-machine\/\" target=\"_blank\">use Win32DiskImager to install the operating system for your Raspberry Pi 3<\/a>.<\/p>\n<p>If you are using a Linux desktop, you should be able to Etcher to install the operating system for your Raspberry Pi 3.<\/p>\n<h2>Enabling SSH server for accessing your Raspberry Pi 3 without connecting a keyboard and monitor to it<\/h2>\n<p>With an SSH server running on Raspbian Jessie Lite, we do not have to find a spare keyboard and monitor in order to configure Raspbian Jessie Lite after it had booted up for the first time. To ensure that we have the SSH server running after the first boot, we can create a file named \"ssh\u201d in the boot partition of the SD card:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspbian-jessie-lite-20170705-boot-with-ssh-file.gif\" alt=\"Raspbian Jessie Lite 20170705 boot with ssh file\"\/><\/p>\n<h2>Assembling the hardware to host ProjectSend<\/h2>\n<p>Once you have installed Raspbian Jessie Lite onto your microSD card, remove your microSD card from your SD card reader and insert it to the SD card slot on the Raspberry Pi 3 board. After that, proceed to <a href=\"\/blog\/how-to-assemble-the-raspberry-pi-3-board-with-the-raspberry-pi-official-case\/\" target=\"_blank\">assemble the Raspberry Pi 3 board to the Official Raspberry Pi case<\/a>.<\/p>\n<h2>Booting up your Raspbian Lite operating system<\/h2>\n<p>With the assembly of your Raspberry Pi 3 board and Official Raspberry Pi case, you need to connect one end of the RJ45 cable to the RJ45 port on your Raspberry Pi 3 board and the other end of the cable to one of the switch port of your home router. After that, plugin your micro USB cable and supply power to your Raspberry Pi 3 board.<\/p>\n<h2>Finding the IP address of your Raspberry Pi 3<\/h2>\n<p>When Raspbian Jessie Lite boots up, it will request an IP address from your router. We will need this IP address in order to SSH into the Raspberry Pi 3. Go to your router's address allocation table and find an entry with the name <strong>raspberrypi<\/strong>. Note that IP address for SSH access.<\/p>\n<h2>SSH into your Rasbian Jessie Lite with the default credentials<\/h2>\n<p>With the IP address, we can then SSH into our Raspberry Pi 3. Assuming that the router had given our Raspberry Pi 3 the IP address <strong>192.168.0.118<\/strong>, we will then open up a terminal program and enter the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nssh pi@192.168.0.118\r\n<\/pre>\n<p>The default password for the default user <strong>pi<\/strong> is <strong>raspberry<\/strong>. Enter <strong>raspberry<\/strong> when the ssh command prompts for a password and we will be able to get into our Raspbian Jessie Lite to perform other configurations.<\/p>\n<p>After logging into your Raspbian Jessie Lite successfully, you will be able to see the following output:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nThe programs included with the Debian GNU\/Linux system are free software;\r\nthe exact distribution terms for each program are described in the\r\nindividual files in \/usr\/share\/doc\/*\/copyright.\r\n\r\nDebian GNU\/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\r\npermitted by applicable law.\r\n\r\nSSH is enabled and the default password for the 'pi' user has not been changed.\r\nThis is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.\r\n<\/pre>\n<h2>Changing the default password for user pi<\/h2>\n<p>As hinted by the server output, we should change the default password for the <strong>pi<\/strong> user. To do so, we enter the following command into the terminal after we had logged into Raspbian Jessie Lite as the <strong>pi<\/strong> user:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npasswd\r\n<\/pre>\n<p>At the prompt, type in <strong>raspberry<\/strong> for <strong>(current) UNIX password<\/strong> and your favourite password for the next two prompts. <\/p>\n<h2>Configuring the locale settings<\/h2>\n<p>Once we have changed the password, we should configure the locale settings too.<\/p>\n<p>To do so, we first run the Raspberry Pi Software Configuration Tool:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo raspi-config\r\n<\/pre>\n<p>And use it to generate the \"en_US.UTF-8\" locale and set it as the default locale for the system environment:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-jessie-lite-with-localisation-options-selected.gif\" alt=\"raspi-config Raspbian Jessie Lite with Localisation Options selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-jessie-lite-with-localisation-options-change-locale-selected.gif\" alt=\"raspi-config Raspbian Jessie Lite with Localisation Options -&gt; Change Locale selected\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-jessie-lite-screen-for-generating-en-us-utf-8-locale.gif\" alt=\"raspi-config Raspbian Jessie Lite screen for generating en_us-UTF-8 locale\"\/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/raspi-config-raspbian-jessie-lite-setting-en-us-utf-8-as-default-locale-for-system-environment.gif\" alt=\"raspi-config Raspbian Jessie Lite settings en_us-UTF-8 as default locale for system environment\"\/><\/p>\n<p>After doing so, open up <code>\/etc\/default\/locale<\/code> with nano:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/default\/locale\r\n<\/pre>\n<p>And updated the contents to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nLANG=en_US.UTF-8\r\nLC_ALL=en_US.UTF-8\r\nLANGUAGE=en_US.UTF-8\r\n<\/pre>\n<p>This will ensure that the locale setting persist through system reboots.<\/p>\n<h2>Installing the MySQL database server on Raspbian Jessie Lite <\/h2>\n<p>ProjectSend requires a MySQL database instance for persisting data. Hence, after setting the locale, we proceed to install MySQL database on Raspbian Jessie Lite.<\/p>\n<p>To do install the MySQL client and MySQL server on Raspbian Jessie Lite, we run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install mysql-server mysql-client -y\r\n<\/pre>\n<p>The command will prompt the following screens for the creation of a password for the root user:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/configuring-mysql-server-5.5-on-raspbian-jessie-lite-enter-root-password.gif\" alt=\"Configuring MySQL Server 5.5 on Raspbian Jessie Lite: Enter root password\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/configuring-mysql-server-5.5-on-raspbian-jessie-lite-repeat-root-password.gif\" alt=\"Configuring MySQL Server 5.5 on Raspbian Jessie Lite: Repeat root password\" \/><\/p>\n<p>After the command had completed, we can run the following command to verify whether MySQL Server was successfully installed:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status mysql\r\n<\/pre>\n<p>If MySQL Server was successfully installed, you will see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf mysql.service - LSB: Start and stop the mysql database server daemon\r\n   Loaded: loaded (\/etc\/init.d\/mysql)\r\n   Active: active (running) since Fri 2017-08-11 11:12:40 UTC; 7min ago\r\n   CGroup: \/system.slice\/mysql.service\r\n           \u251c\u25006110 \/bin\/sh \/usr\/bin\/mysqld_safe\r\n           \u2514\u25006454 \/usr\/sbin\/mysqld --basedir=\/usr --datadir=\/var\/lib\/mysql --plugin-dir=\/usr\/lib\/mysql\/plugin -...\r\n\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.general_log                                  OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.help_category                                OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.help_keyword                                 OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.help_relation                                OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.help_topic                                   OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.host                                         OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.ndb_binlog_index                             OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.plugin                                       OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.proc                                         OK\r\nAug 11 11:12:57 raspberrypi \/etc\/mysql\/debian-start&#x5B;6525]: mysql.procs_priv                                   OK\r\n\r\n<\/pre>\n<h2>Installing PHP on Raspbian Jessie Lite<\/h2>\n<p>Since ProjectSend is written in PHP, we will install the necessary PHP components next. To install PHP on Raspbian Jessie Lite, we will run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php5 php5-fpm php5-mysql -y\r\n<\/pre>\n<p>After the command had completed, we can run the following to verify whether the PHP FastCGI Process Manager is up and running:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status php5-fpm\r\n<\/pre>\n<p>You should see output similar to the following if PHP FastCGI Process Manager is running fine:<\/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)\r\n   Active: active (running) since Fri 2017-08-11 15:10:02 UTC; 4min 7s ago\r\n Main PID: 10998 (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\u250010998 php-fpm: master process (\/etc\/php5\/fpm\/php-fpm.conf)\r\n           \u251c\u250011000 php-fpm: pool www\r\n           \u2514\u250011001 php-fpm: pool www\r\n\r\nAug 11 15:10:02 raspberrypi systemd&#x5B;1]: Started The PHP FastCGI Process Manager.\r\nAug 11 15:10:04 raspberrypi systemd&#x5B;1]: Started The PHP FastCGI Process Manager.\r\n<\/pre>\n<h2>Configuring PHP FPM to listen on a port rather than unix socket<\/h2>\n<p>If you have a reverse proxy server sitting on a different device, you will need to configure your PHP FastCGI Process Manager to listen on a port so that the reverse proxy server is able to talk to your PHP FPM.<\/p>\n<p>To configure PHP FPM to listen on a port rather than through unix socket, open up <code>\/etc\/php5\/fpm\/pool.d\/www.conf<\/code> and look for the 'listen' variable and set it to a port number (for example 9000):<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nlisten = 9000\r\n<\/pre>\n<p>Once you had saved your changes, restart PHP FPM by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart php5-fpm.service\r\n<\/pre>\n<p>You can verify whether your PHP FPM is listening on your new port by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo netstat -lptn\r\n<\/pre>\n<p>You should see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nActive Internet connections (only servers)\r\nProto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name\r\ntcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN      2068\/php-fpm.conf)\r\n<\/pre>\n<h2>Installing nginx server<\/h2>\n<p>If you had <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-setup-a-reverse-proxy-server-with-nginx-raspian-jessie-lite-and-raspberry-pi-3\/\" target=\"_blank\">setup a reverse proxy server with nginx, Raspian Jessie Lite and Raspberry Pi 3<\/a> or have an <a href=\"https:\/\/nginx.org\/\" target=\"_blank\">nginx<\/a> server running somewhere in your home network, you can skip this section.<\/p>\n<p>If you do not have a dedicated <a href=\"\/blog\/the-reverse-proxy-server\/\" target=\"_blank\">reverse proxy server<\/a>, you may want to install it on the same Raspberry Pi 3. <\/p>\n<p>To install nginx server on Raspbian Jessie Lite, you can run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\nsudo apt-get install nginx -y --fix-missing\r\n<\/pre>\n<p>Run the following command to verify that your nginx server is running successfully:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncurl -0 http:\/\/localhost\r\n<\/pre>\n<p>You should see output similar to the following if your nginx server is running successfully:<\/p>\n<pre class=\"brush: bash; 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 on Debian!&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 on Debian!&lt;\/h1&gt;\r\n&lt;p&gt;If you see this page, the nginx web server is successfully installed and\r\nworking on Debian. 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;\/p&gt;\r\n\r\n&lt;p&gt;\r\n      Please use the &lt;tt&gt;reportbug&lt;\/tt&gt; tool to report bugs in the\r\n      nginx package with Debian. However, check &lt;a\r\n      href=&quot;http:\/\/bugs.debian.org\/cgi-bin\/pkgreport.cgi?ordering=normal;archive=0;src=nginx;repeatmerged=0&quot;&gt;existing\r\n      bug reports&lt;\/a&gt; before reporting a new bug.\r\n&lt;\/p&gt;\r\n\r\n&lt;p&gt;&lt;em&gt;Thank you for using debian and nginx.&lt;\/em&gt;&lt;\/p&gt;\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2>Getting a copy of ProjectSend<\/h2>\n<p>As of this writing, the latest version of ProjectSend is r754. To download this version of ProjectSend from your Raspbian Jessie Lite, you can run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/var\/www \r\nsudo wget https:\/\/github.com\/ignacionelson\/ProjectSend\/archive\/r756.zip\r\nsudo unzip r756.zip\r\nsudo rm r756.zip\r\n<\/pre>\n<p>With that you will have the source codes at <code>\/var\/www\/ProjectSend-r756<\/code>.<\/p>\n<h2>Changing the owner of ProjectSend's upload folder<\/h2>\n<p>In order for the file upload feature to work correctly, the user that runs PHP FPM had to own ProjectSend's upload folder. The PHP FPM is run by the www-data user by default. Therefore, we need to run the following command to change the ownership of ProjectSend's upload folder to the www-data user:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo chown -R www-data:www-data \/var\/www\/ProjectSend-r756\/upload\r\n<\/pre>\n<h2>Creating a new MySQL user and a database instance for your ProjectSend website<\/h2>\n<p>Your instance of ProjectSend will require a MySQL user along with a database instance for data persistence. To begin with the creation of the user and database instance, we first login to the MySQL server instance with the MySQL client:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql -u root -p\r\n<\/pre>\n<p>After providing your password to the password prompt, you can then create the database instance:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql&gt; CREATE DATABASE myProjectSendDb;\r\n<\/pre>\n<p>Once your database instance had been created successfully, proceed on to create the MySQL user which could interact with it:<\/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 myProjectSendDb.* TO 'anewuser'@'localhost';\r\n<\/pre>\n<h2>Creating ProjectSend configuration file for interacting with the database instance<\/h2>\n<p>Inside the <code>\/var\/www\/ProjectSend-r756\/includes<\/code> directory, there is a <code>sys.config.sample.php<\/code> for us to use as a basis for configuring our ProjectSend instance. <\/p>\n<p>To configure our ProjectSend instance, we first make a copy of the sample configuration, naming it as <code>sys.config.php<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo cp \/var\/www\/ProjectSend-r756\/includes\/sys.config.sample.php \/var\/www\/ProjectSend-r756\/includes\/sys.config.php\r\n<\/pre>\n<p>Based on the example values that we had defined earlier, we will replace the database definitions inside <code>sys.config.php<\/code> to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\/** Database name *\/\r\ndefine('DB_NAME', 'myProjectSendDb');\r\n\r\n\/** Database host (in most cases it's localhost) *\/\r\ndefine('DB_HOST', 'localhost');\r\n\r\n\/** Database username (must be assigned to the database) *\/\r\ndefine('DB_USER', 'anewuser');\r\n\r\n\/** Database password *\/\r\ndefine('DB_PASSWORD', 'password');\r\n<\/pre>\n<h2>Preventing incorrect table definition for MySQL Server versions below 5.6<\/h2>\n<p>Since as of this writing, the MySQL server that was installed was 5.5.57, there cannot be more than one column in a table with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause. <\/p>\n<p>Hence, we need to edit a particular column definition inside <code>\/var\/www\/ProjectSend-r756\/install\/database.php<\/code>. Look for <strong>expiry_date<\/strong> and change the code to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n`expiry_date` TIMESTAMP NOT NULL DEFAULT &quot;2017-01-01 00:00:00&quot;\r\n<\/pre>\n<h2>Configuring nginx to serve HTTP requests for your ProjectSend website<\/h2>\n<p>To reach our ProjectSend website, we will need to <a href=\"https:\/\/www.techcoil.com\/blog\/configuring-nginx-for-php-web-applications\/\" rel=\"noopener\" target=\"_blank\">configure our nginx to proxy HTTP requests to our PHP web application<\/a> served by PHP FPM. <\/p>\n<p>Assuming that we had created a DNS type A record which points <code>sf.anexistingurl.com<\/code> to our reverse proxy server, the following configuration is what we will need to configure our nginx to proxy HTTP requests to our PHP FPM instance:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen   80;\r\n    root \/var\/www\/ProjectSend-r756;\r\n    index index.php index.html;\r\n \r\n    server_name sf.anexistingurl.com;\r\n \r\n    location \/ {\r\n        # First attempt to serve request as file, then\r\n        # as directory, then fall back to index.html\r\n        try_files $uri $uri\/ \/index.html;\r\n    }\r\n \r\n    error_page 404 \/404.html;\r\n \r\n    # redirect server error pages to the static page \/50x.html\r\n    error_page 500 502 503 504 \/50x.html;\r\n    location = \/50x.html {\r\n        root \/usr\/share\/nginx\/www;\r\n    }\r\n \r\n    # pass the PHP scripts to FastCGI server \r\n    location ~ \\.php$ {\r\n                fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\r\n \r\n                fastcgi_index index.php;\r\n                include fastcgi_params;\r\n                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n                fastcgi_pass 192.168.0.118:9000;\r\n    }\r\n}\r\n<\/pre>\n<p>On my <a href=\"\/blog\/how-to-setup-a-reverse-proxy-server-with-nginx-raspian-jessie-lite-and-raspberry-pi-3\/\" target=\"_blank\">Raspbian Jessie Lite reverse proxy server<\/a>, I will save this file as <code><strong>\/etc\/nginx\/sites-enabled\/sf.anexistingurl.com.conf<\/strong><\/code>.<\/p>\n<p>After I do so, I would restart nginx with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h2>Running the install script of ProjectSend<\/h2>\n<p>Once you got the nginx configurations in place, you can then access <code>http:\/\/sf.anexistingurl.com\/install<\/code> with your browser. Complete the necessary details and click on the <code>Install<\/code> button:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/accessing-ProjectSend-running-on-Raspbian-Jessie-Lite-from-chrome.gif\" alt=\"Accessing ProjectSend running on Raspbian Jessie Lite from chrome\"\/><\/p>\n<p>Once you do so, you will see the following screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/successfully-installed-ProjectSend-on-Raspbian-Jessie-Lite.gif\" alt=\"Successfully installed ProjectSend on Raspbian Jessie Lite\" \/><\/p>\n<h2 id=\"configuring-ssl\">Configuring SSL for your ProjectSend website<\/h2>\n<p>With Let's Encrypt, getting an SSL certificate comes with no cost. Since we may be sharing private files with our friends, why not go further to configure SSL for our ProjectSend website?<\/p>\n<h3>Installing CertBot on our Raspbian Jessie Lite reverse proxy server<\/h3>\n<p>With an ACME client like <a href=\"https:\/\/certbot.eff.org\/\" target=\"_blank\">CertBot<\/a>, we will be able to automate the retrieval of SSL artefacts from Let's Encrypt. If you do not have CertBot installed on your Raspbian Jessie Lite reverse proxy server, you will need to <a href=\"\/blog\/installing-certbot-on-raspbian-jessie-lite-for-deploying-lets-encrypt-certificates\/\" target=\"_blank\">install it first<\/a>. <\/p>\n<h3>Configuring nginx to demonstrate control over your domain<\/h3>\n<p>The Let's Encrypt server will look for some random file written by Certbot at the <code>\/.well-known<\/code> uri path of our domain in order to be convinced that we owned the domain that we wish to secure with HTTPS.<\/p>\n<p>Therefore, we will have to modify our nginx configuration to serve files via the <code>\/.well-known<\/code> uri. To do so, I will open up <code><strong>\/etc\/nginx\/sites-enabled\/sf.anexistingurl.com.conf<\/strong><\/code> and add the following nginx configuration block inside the server block:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nlocation ~ \/.well-known {\r\n    allow all;\r\n}\r\n<\/pre>\n<p>The resultant nginx configuration file will look like this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen   80;\r\n    root \/var\/www\/ProjectSend-r756;\r\n    index index.php index.html;\r\n \r\n    server_name sf.anexistingurl.com;\r\n \r\n    location \/ {\r\n        # First attempt to serve request as file, then\r\n        # as directory, then fall back to index.html\r\n        try_files $uri $uri\/ \/index.html;\r\n    }\r\n \r\n    error_page 404 \/404.html;\r\n \r\n    # redirect server error pages to the static page \/50x.html\r\n    error_page 500 502 503 504 \/50x.html;\r\n    location = \/50x.html {\r\n        root \/usr\/share\/nginx\/www;\r\n    }\r\n \r\n    # pass the PHP scripts to FastCGI server \r\n    location ~ \\.php$ {\r\n        fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\r\n \r\n        fastcgi_index index.php;\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        fastcgi_pass 192.168.0.118:9000;\r\n    }\r\n\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }\r\n}\r\n<\/pre>\n<p>Once I had saved the changes made to the nginx configuration file, I restart nginx by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h3>Using Certbot to get Let's Encrypt to issue the SSL certificate for our domain<\/h3>\n<p>After the nginx configurations is being applied, we are ready to use Certbot to get Let's Encrypt to issue the SSL certificate for our domain. To do so, enter the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo certbot certonly --webroot -w \/var\/www\/ProjectSend-r756 -d sf.anexistingurl.com\r\n<\/pre>\n<p>When the command runs for the very first time on your machine, it will ask for an email address to notify when the SSL certificate is going to expire and an agreement to Let's Encrypt Terms of Service.<\/p>\n<p>Once we have given the necessary responses, CertBot will create the SSL artefacts inside the <code>\/etc\/letsencrypt\/live\/sf.anexistingurl.com<\/code> folder. Inside <code>\/etc\/letsencrypt\/live\/sf.anexistingurl.com<\/code>, we will also find cert.pem, chain.pem, fullchain.pem and privkey.pem. The files inside <code>\/etc\/letsencrypt\/live\/sf.anexistingurl.com<\/code> folder are symbolic links for facilitating certificate renewal without changing our server side configurations.<\/p>\n<h2>Generating a strong Diffie-Hellman group<\/h2>\n<p>After the SSL certificate and the corresponding private key were created successfully, we should also precompute a strong Diffie-Hellman group for our reverse proxy server to use for exchanging cryptographic keys with its clients:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo openssl dhparam -out \/etc\/ssl\/certs\/dhparam.pem 2048\r\n<\/pre>\n<p>This process will take a very long time to complete but it will be worth the effort as it would make communicating with our server more secure.<\/p>\n<h2>Creating the nginx configurations for serving HTTPS for your ProjectSend website<\/h2>\n<p>Apart from enabling HTTPS communication on port 443 of our Raspbian Jessie Lite reverse proxy server, we also want any HTTP request made to port 80 to be redirected to port 443 via the HTTPS protocol. To serve such a use case, we will open up <code><strong>\/etc\/nginx\/sites-enabled\/sf.anexistingurl.com.conf<\/strong><\/code> and replace the content with the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# Redirect HTTP requests to HTTPS \r\nserver {\r\n    listen 80;\r\n    server_name  sf.anexistingurl.com;\r\n    return 301 https:\/\/$host$request_uri;\r\n}\r\n  \r\n# For ssl\r\nserver {\r\n    ssl on;\r\n    ssl_certificate \/etc\/letsencrypt\/live\/sf.anexistingurl.com\/fullchain.pem;\r\n    ssl_certificate_key \/etc\/letsencrypt\/live\/sf.anexistingurl.com\/privkey.pem;\r\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n    ssl_prefer_server_ciphers on;\r\n    ssl_dhparam \/etc\/ssl\/certs\/dhparam.pem;\r\n    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';\r\n    ssl_session_timeout 1d;\r\n    ssl_session_cache shared:SSL:50m;\r\n    ssl_stapling on;\r\n    ssl_stapling_verify on;\r\n    add_header Strict-Transport-Security max-age=15768000;\r\n      \r\n    default_type  application\/octet-stream;\r\n      \r\n    listen 443;\r\n    server_name  sf.anexistingurl.com;\r\n  \r\n    root \/var\/www\/ProjectSend-r756;\r\n    index index.php index.html;\r\n  \r\n    location \/ {\r\n        # First attempt to serve request as file, then\r\n        # as directory, then fall back to index.html\r\n        try_files $uri $uri\/ \/index.html;\r\n    }\r\n \r\n    error_page 404 \/404.html;\r\n \r\n    # redirect server error pages to the static page \/50x.html\r\n    error_page 500 502 503 504 \/50x.html;\r\n    location = \/50x.html {\r\n        root \/usr\/share\/nginx\/www;\r\n    }\r\n \r\n    # pass the PHP scripts to FastCGI server \r\n    location ~ \\.php$ {\r\n        fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\r\n \r\n        fastcgi_index index.php;\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        fastcgi_pass 192.168.0.118:9000;\r\n    }\r\n\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }\r\n}\r\n<\/pre>\n<p>And after we had saved the changes, we restart nginx with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h3>Updating base uri to reflect https<\/h3>\n<p>Since ProjectSend saved the base uri with the protocol scheme, we need to change it in order for ProjectSend to work properly via HTTPS. To do so, we first log into our MySQL server through the MySQL client:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mysql -u root -p\r\n<\/pre>\n<p>After entering the password, we run the following SQL statement to update the base uri with <code>https:\/\/<\/code> as the protocol scheme:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql&gt; UPDATE tbl_options SET value = 'https:\/\/sf.anexistingurl.com\/' WHERE name = 'base_uri';\r\n<\/pre>\n<h2>Buying the recommended hardware list to setup your own ProjectSend website with Raspbian Jessie Lite<\/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=\"B01CCPKCSK\"\/><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"\/><input name=\"ASIN.3\" type=\"hidden\" value=\"B010Q57S62\"\/><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"\/><input name=\"ASIN.4\" type=\"hidden\" value=\"B00MARDJZ4\"\/><input name=\"Quantity.4\" type=\"hidden\" value=\"1\"\/><input name=\"ASIN.5\" type=\"hidden\" value=\"B00N2VISLW\"\/><input name=\"Quantity.5\" 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-cL\" 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-cL&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-cL&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%2F791&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>Do you have large files that you want to share with your friends or clients? Do you keep your Internet connection on 24-7? <\/p>\n<p>Compared to using Google Drive, Dropbox or other on-the-cloud file sharing software, hosting your own file sharing software when you never switch off your Internet has a few advantages. <\/p>\n<p>Provided that your friends don&#8217;t share your files with others, your files stay at home and on your friends&#8217; machines. Furthermore, you are only limited by the amount of storage that you have on your machine. <\/p>\n<p>If you have a Raspberry Pi 3 in your house, you may want to consider setting up <a href=\"http:\/\/www.projectsend.org\/\" target=\"_blank\">ProjectSend<\/a> on your <a href=\"https:\/\/techcoil.com\/blog\/tag\/raspberry-pi-3\" target=\"_blank\">Raspberry Pi 3<\/a> for sharing files with others. This post shows how to do it with a LEMP stack.<\/p>\n","protected":false},"author":1,"featured_media":797,"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":false,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[436,437,250,242,225,13,435,240,308,432,438],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/accessing-ProjectSend-running-on-Raspbian-Jessie-Lite-from-chrome.gif","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-cL","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/791"}],"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=791"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/791\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/797"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}