{"id":279,"date":"2018-06-12T22:22:23","date_gmt":"2018-06-12T14:22:23","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=279"},"modified":"2019-03-05T15:31:52","modified_gmt":"2019-03-05T07:31:52","slug":"how-to-host-your-own-file-sharing-website-on-raspberry-pi-3-with-raspbian-stretch-lite-nginx-projectsend-mariadb-and-php","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-to-host-your-own-file-sharing-website-on-raspberry-pi-3-with-raspbian-stretch-lite-nginx-projectsend-mariadb-and-php\/","title":{"rendered":"How to host your own file sharing website on Raspberry Pi 3 with Raspbian Stretch Lite, Nginx, ProjectSend, MariaDB and PHP"},"content":{"rendered":"<p>While <a href=\"https:\/\/www.booking.com\/hotel\/fi\/northern-lights-village.en-gb.html?aid=357004;label=gog235jc-hotel-XX-fi-northernNlightsNvillage-unspec-sg-com-L%3Aen-O%3AosSx-B%3Achrome-N%3AXX-S%3Abo-U%3AXX-H%3As;sid=2f2a77c9490aee253638a1785a67003f;dist=0&sb_price_type=total&type=total&\" rel=\"noopener noreferrer\" target=\"_blank\">experiencing Northern Lights in Finland<\/a>, you may <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-capture-the-northern-lights-with-an-entry-level-dslr\/\" rel=\"noopener noreferrer\" target=\"_blank\">capture some Northern Lights pictures with your DSLR<\/a>. In case you want to share them with friends through your own file sharing website, have a look at <a href=\"https:\/\/www.projectsend.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">ProjectSend<\/a>. <\/p>\n<p>Since a <a href=\"https:\/\/www.amazon.com\/ELEMENT-Element14-Raspberry-Pi-Motherboard\/dp\/B07BDR5PDW\/ref=sr_1_9?s=pc&ie=UTF8&qid=1527832201&sr=1-9\" rel=\"noopener noreferrer\" target=\"_blank\">Raspberry Pi 3<\/a> is energy efficient and affordable, you may want to setup ProjectSend on a Raspberry Pi 3. With this in mind, this post discusses how to do so with Raspbian Stretch Lite, <a href=\"http:\/\/nginx.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">Nginx<\/a>, <a href=\"https:\/\/mariadb.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">MariaDB<\/a> and <a href=\"http:\/\/php.net\/\" rel=\"noopener noreferrer\" target=\"_blank\">PHP<\/a> as the <a href=\"https:\/\/www.techcoil.com\/glossary\/lemp\" rel=\"noopener noreferrer\" target=\"_blank\">LEMP<\/a> stack.  <\/p>\n<h2>Recommended hardware list to build your Raspberry Pi 3 file sharing website<\/h2>\n<p>In case you need some reference on <a href=\"https:\/\/www.techcoil.com\/raspberry-pi-3-buying-guide\/\" rel=\"noopener noreferrer\" target=\"_blank\">what you can buy for this Raspberry Pi 3 project<\/a>, the following is a list of hardware recommendations for you:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.amazon.com\/CanaKit-Raspberry-Micro-Supply-Listed\/dp\/B01C6FFNY4\/ref=as_li_ss_tl?s=pc&ie=UTF8&qid=1517212574&sr=1-4&keywords=raspberry+pi+3&linkCode=ll1&tag=clivsperswebs-20&linkId=76113a630916ac804456aa1f5dd76c85\" rel=\"noopener noreferrer\" target=\"_blank\">CanaKit Raspberry Pi 3 with 2.5A Micro USB Power Supply<\/a> or <a href=\"https:\/\/www.amazon.com\/CanaKit-Raspberry-Power-Supply-Listed\/dp\/B07BC6WH7V\/\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=facc24accf03fbe5cd45b1893a1e9ab1\" rel=\"noopener noreferrer\" target=\"_blank\">CanaKit Raspberry Pi 3 B+ (B Plus) with 2.5A Power Supply (UL Listed)<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/dp\/B01F1PSFY6\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=d68c56d79a1d84f89f596fa715743a9e\" rel=\"noopener noreferrer\" target=\"_blank\">Raspberry Pi 2\/3 official case Black\/Grey<\/a> or <a href=\"https:\/\/www.amazon.com\/dp\/B01CCPKCSK\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=1e69ae5649504fb86c6597e0774eb3d8\" rel=\"noopener noreferrer\" target=\"_blank\">Raspberry Pi 2\/3 official case Red\/White<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/Sandisk-Ultra-Micro-UHS-I-Adapter\/dp\/B073JYVKNX\/ref=as_li_ss_tl?s=electronics&ie=UTF8&qid=1519546458&sr=1-1-fkmr0&keywords=Sandisk+Ultra+64GB+Micro+SDHC+UHS-I+Card+with+Adapter+-+98MB\/s+U1+A1&linkCode=ll1&tag=clivsperswebs-20&linkId=63030733e82634a740772cf7f154c197\" rel=\"noopener noreferrer\" target=\"_blank\">Sandisk Ultra 64GB Micro SDXC UHS-I Card with Adapter - 100MB\/s U1 A1<\/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=132403a064ff21634835c1deee4bc983\" target=\"_blank\" rel=\"noopener noreferrer\">AmazonBasics RJ45 Cat-6 Ethernet Patch Cable - 3 Feet (0.9 Meters)<\/a><\/li>\n<\/ul>\n<h2>Setting up Raspbian Stretch Lite with SSH server enabled on your microSD card<\/h2>\n<p>After you had gathered all the necessary hardware, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-setup-raspbian-stretch-lite-with-ssh-server-enabled-on-your-microsd-card\/\" rel=\"noopener noreferrer\" target=\"_blank\">setup Raspbian Stretch Lite with SSH server enabled on your microSD card<\/a>. Once you had done so, you will be able to SSH into your Raspbian Stretch Lite to perform further configurations.<\/p>\n<h2>Assembling the hardware for the Raspberry Pi 3<\/h2>\n<p>After you had prepared the microSD card with Raspbian Stretch Lite as the operating system, remove the microSD card from your SD card reader and insert it to the microSD card slot on the Raspberry Pi 3 board. After that, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-assemble-the-raspberry-pi-3-board-with-the-raspberry-pi-official-case\/\" rel=\"noopener noreferrer\" target=\"_blank\">assemble the Raspberry Pi 3 board to the Official Raspberry Pi case<\/a>.<\/p>\n<h2>Starting the Raspbian Stretch Lite operating system<\/h2>\n<p>When you had assembled the Raspberry Pi 3 board with the Official Raspberry Pi case, you are ready to start the Raspbian Stretch Lite operating system. In order to do so, first connect one end of the RJ45 cable to the RJ45 port on the Raspberry Pi 3 board and the other end of the cable to one of the switch port of your <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=home+router&linkCode=ll2&tag=clivsperswebs-20&linkId=be772faf0f97c209171c09a726221920\" rel=\"noopener noreferrer\" target=\"_blank\">home router<\/a>. After that, connect the micro USB power supply to the Raspberry Pi 3 board and a wall socket. Lastly, turn on the power socket to supply power to the Raspberry Pi 3 board.<\/p>\n<h2>Changing default password, Locale and Timezone of your Raspbian Stretch Lite<\/h2>\n<p>There are a few configurations that you should perform on the first run of your Raspbian Stretch Lite. With this in mind, <a href=\"https:\/\/www.techcoil.com\/blog\/set-of-configurations-to-perform-on-the-first-run-of-your-raspbian-stretch-lite\/\" rel=\"noopener noreferrer\" target=\"_blank\">proceed to change the default password, Locale and Timezone of your Raspbian Stretch Lite<\/a>.<\/p>\n<h2>Installing Nginx on Raspbian Stretch Lite<\/h2>\n<p>After you had performed the first set of configurations for your Raspbian Stretch Lite, proceed to install Nginx. In order to install Nginx on Raspbian Stretch Lite, you need to run the following commands:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\nsudo apt-get install nginx -y\r\n<\/pre>\n<p>Once the commands complete, verify your Nginx installation by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status nginx.service\r\n<\/pre>\n<p>After you had ran the command, you should see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n   Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2018-06-06 22:38:24 +08; 5min ago\r\n     Docs: man:nginx(8)\r\n  Process: 1513 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n  Process: 1510 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n Main PID: 1514 (nginx)\r\n   CGroup: \/system.slice\/nginx.service\r\n           \u251c\u25001514 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\r\n           \u251c\u25001515 nginx: worker process\r\n           \u251c\u25001516 nginx: worker process\r\n           \u251c\u25001517 nginx: worker process\r\n           \u2514\u25001518 nginx: worker process\r\n\r\nJun 06 22:38:24 raspberrypi systemd&#x5B;1]: Starting A high performance web server and a reverse proxy server...\r\nJun 06 22:38:24 raspberrypi systemd&#x5B;1]: Started A high performance web server and a reverse proxy server...\r\n<\/pre>\n<h2>Installing the MariaDB on Raspbian Stretch Lite<\/h2>\n<p>Once you had installed Nginx, proceed to install MariaDB on Raspbian Stretch Lite. In order to do so, run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install mariadb-server mariadb-client -y\r\n<\/pre>\n<p>After the command complete, you will have the MariaDB server and the MariaDB client installed on your Raspbian Stretch Lite.<\/p>\n<p>At this time, the installation of <code>mariadb-server<\/code> did not prompt for a root password. In essence, this is because the root user was by default set to use the <code>unix_socket<\/code> plugin. As a result of that, the operating system user credentials are used when connecting to MariaDB via Unix socket.<\/p>\n<p>Since the pi user of Raspbian Stretch was configured to use <code>sudo<\/code> without password prompt, you should get into <code>mariadb-server<\/code> by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mariadb\r\n<\/pre>\n<p>After you run the command, you should see the following prompt:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 2\r\nServer version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0\r\n \r\nCopyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.\r\n \r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n \r\nMariaDB &#x5B;(none)]&gt; \r\n<\/pre>\n<p>When you can see that, it will mean that MariaDB was installed successfully. <\/p>\n<p>Type <strong>exit<\/strong> in the MariaDB prompt to continue on with the rest of the installation.<\/p>\n<h2>Installing PHP 7 on Raspbian Stretch Lite<\/h2>\n<p>Following the installation of MariaDB, proceed to install PHP 7 and related components to run ProjectSend. In order to do so, you need to run the following commands:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y\r\n<\/pre>\n<p>After the installation complete, run the following command to check the status of PHP FPM:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl status php7.0-fpm.service\r\n<\/pre>\n<p>As a result of doing so, you should see output similar to the following if PHP 7 was installed successfully:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager\r\n   Loaded: loaded (\/lib\/systemd\/system\/php7.0-fpm.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Fri 2018-06-08 17:20:57 +08; 2min 54s ago\r\n     Docs: man:php-fpm7.0(8)\r\n Main PID: 10133 (php-fpm7.0)\r\n   Status: &quot;Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req\/sec&quot;\r\n   CGroup: \/system.slice\/php7.0-fpm.service\r\n           \u251c\u250010133 php-fpm: master process (\/etc\/php\/7.0\/fpm\/php-fpm.conf)\r\n           \u251c\u250010134 php-fpm: pool www\r\n           \u2514\u250010135 php-fpm: pool www\r\n\r\nJun 08 17:20:57 raspberrypi systemd&#x5B;1]: Starting The PHP 7.0 FastCGI Process Manager...\r\nJun 08 17:20:57 raspberrypi systemd&#x5B;1]: Started The PHP 7.0 FastCGI Process Manager.\r\n<\/pre>\n<h2>Getting a copy of ProjectSend<\/h2>\n<p>Once you had installed PHP 7 and the necessary components, the next step is to download a copy of ProjectSend. At this time, the latest version of ProjectSend is r1053. Hence, run the following commands to get a copy of ProjectSend:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/var\/www\r\nsudo wget https:\/\/github.com\/projectsend\/projectsend\/archive\/r1053.zip\r\nsudo unzip r1053.zip\r\nsudo rm r1053.zip\r\n<\/pre>\n<p>After that, you will have ProjectSend source codes at <code>\/var\/www\/projectsend-r1053<\/code>.<\/p>\n<h2>Changing the owner of ProjectSend's upload folder<\/h2>\n<p>In order to ensure that the file upload feature work correctly, the system user that runs PHP FPM had to own ProjectSend's upload folder. Since the PHP FPM is run by the <code>www-data<\/code> user by default, you need to change the ownership of ProjectSend's upload folder to the <code>www-data<\/code> user. For this purpose, you will need to run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo chown -R www-data:www-data \/var\/www\/projectsend-r1053\/upload\r\n<\/pre>\n<h2>Creating a new MariaDB user and a database instance for your ProjectSend website<\/h2>\n<p>Your instance of ProjectSend will require a MariaDB user along with a database instance for data persistence. To begin with the creation of the user and database instance, first get into the MariaDB server instance with the MariaDB client:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mariadb\r\n<\/pre>\n<p>Once the MariaDB client loads up, run the following SQL command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nCREATE DATABASE myProjectSendDb;\r\n<\/pre>\n<p>After your database instance had been created successfully, proceed on to create the MariaDB user which can interact with it:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nCREATE USER 'anewuser'@'localhost' IDENTIFIED BY 'password';\r\nGRANT ALL ON myProjectSendDb.* TO 'anewuser'@'localhost';\r\n<\/pre>\n<h2>Creating ProjectSend configuration file for interacting with the database instance<\/h2>\n<p>As can be seen, there is a <code>sys.config.sample.php<\/code> file inside the <code>\/var\/www\/projectsend-r1053\/includes<\/code> directory. Therefore, you can use that file as a basis for configuring your ProjectSend instance.<\/p>\n<p>To configure your ProjectSend instance, first make a copy of the sample configuration and name it as <code>sys.config.php<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo cp \/var\/www\/projectsend-r1053\/includes\/sys.config.sample.php \/var\/www\/projectsend-r1053\/includes\/sys.config.php\r\n<\/pre>\n<p>Given that you had created the database details earlier, open up <code>\/var\/www\/projectsend-r1053\/includes\/sys.config.php<\/code> with <code>nano<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/var\/www\/projectsend-r1053\/includes\/sys.config.php\r\n<\/pre>\n<p>Once the editor loads the file, 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<p>After you had made the changes, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the changes.<\/p>\n<h2>Configuring Nginx for running install script of your ProjectSend website<\/h2>\n<p>Once you had created the ProjectSend configuration file, proceed on to configure Nginx for running install script of your ProjectSend website. In order to do so, first open up the default Nginx configuration at <code>\/etc\/nginx\/sites-enabled\/projectsend.conf<\/code>:  <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/projectsend.conf\r\n<\/pre>\n<p>Once the editor loads the file, change the contents to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen   80 default_server;\r\n    root \/var\/www\/projectsend-r1053;\r\n    index index.php;\r\n  \r\n    server_name _;\r\n  \r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php?$args;\r\n    }\r\n  \r\n    location ~ \\.php$ {\r\n        include fastcgi.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }\r\n}\r\n<\/pre>\n<p>After you had made the changes, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the changes. <\/p>\n<p>Following the creation of <code>\/etc\/nginx\/sites-enabled\/projectsend.conf<\/code>, remove <code>\/etc\/nginx\/sites-enabled\/default<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo rm \/etc\/nginx\/sites-enabled\/default\r\n<\/pre>\n<p>Once you had removed the default Nginx configurations, 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<h2>Running the install script of ProjectSend<\/h2>\n<p>At this point, you are ready to run the install script of ProjectSend. For the purpose of this guide, let's assume that your Raspberry Pi 3 had gotten <strong>192.168.1.115<\/strong> as the IP address from your router. Given that, use your browser to access <strong>http:\/\/192.168.1.115\/install<\/strong>.<\/p>\n<p>Subsequently, you will see the following page for you to specify some initial configurations for your ProjectSend installation:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/ProjectSend-r1053-setup-page.gif\" alt=\"ProjectSend r1053 setup page\"\/><\/p>\n<p>Once you had filled in your own configurations, click on the <strong>Install<\/strong> button. Afterwards, you will be presented with the following page:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/ProjectSend-r1053-setup-success-page.gif\" alt=\"ProjectSend r1053 setup success page\" \/> <\/p>\n<h2>Serving your ProjectSend website via HTTPs<\/h2>\n<p>At this time, you have a file sharing website that you can access from within your home network. However, a file sharing website should be accessible from outside your home network in a secured way. Given these points, this section will discuss how you can serve your ProjectSend website via HTTPS.  <\/p>\n<h3>Prequisites<\/h3>\n<p>Previously, we had discussed the topic on <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-host-multiple-websites-from-home\/\" rel=\"noopener noreferrer\" target=\"_blank\">how to host multiple websites from home<\/a>. Following those pointers, you will need the following pieces for your ProjectSend site to be accessed from outside your home network, via HTTPS with Let's Encrypt browser-trusted certificate:<\/p>\n<ul>\n<li>A domain or subdomain name that is mapped to the public IP address that your <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=home+network+router&rh=i:aps,k:home+network+router&linkCode=ll2&tag=clivsperswebs-20&linkId=6d206156ec9fc599fc44332cd5cfe69d\" rel=\"noopener noreferrer\" target=\"_blank\">home router<\/a> had gotten from the Internet Service Provider.<\/li>\n<li>Forwarding of network traffic made to port 80 and 443 of your home router public IP address to the IP address of the Raspberry Pi 3 that contains your ProjectSend site. If you happen to use <a href=\"https:\/\/www.amazon.com\/Linksys-AC1900-Wireless-Router-EA7500\/dp\/B019WAQMVY\/ref=as_li_ss_tl?&imprToken=qcAImKE7aE8G.bRcryc8vw&slotNum=0&ie=UTF8&qid=1503367796&sr=8-2&keywords=linksys+ea7500+max-stream%E2%84%A2+ac1900&linkCode=ll1&tag=clivsperswebs-20&linkId=fc9a5b11e3d3873d432686f3e699a1e6\" rel=\"noopener noreferrer\" target=\"_blank\">Linksys EA7500 Max-Stream AC1900 router<\/a>, you can <a href=\"https:\/\/www.techcoil.com\/blog\/host-web-server-behind-linksys-ea7500-max-stream-ac1900-router\/\" rel=\"noopener noreferrer\" target=\"_blank\">checkout this post on how to do so<\/a>.<\/li>\n<\/ul>\n<h3>Installing Certbot on Raspbian Stretch Lite<\/h3>\n<p>Once you had met the pre-requisites, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/installing-certbot-on-raspbian-stretch-lite-for-obtaining-lets-encrypts-browser-trusted-certificates\/\" rel=\"noopener noreferrer\" target=\"_blank\">install Certbot on Raspbian Stretch Lite<\/a>.<\/p>\n<h3>Configuring Nginx to facilitate Certbot in acquiring the SSL certificate for your domain or subdomain<\/h3>\n<p>After installing Certbot, proceed on to configure Nginx to facilitate Certbot in acquiring the SSL certificate for your domain. For the purpose of this guide, let's assume that you had designated <strong>ps.yourdomain.com<\/strong> as the domain to reach your ProjectSend site on your Raspberry Pi 3.<\/p>\n<p>With this in mind, let's first move <code>\/etc\/nginx\/sites-enabled\/projectsend.conf<\/code> to <code>\/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mv \/etc\/nginx\/sites-enabled\/projectsend.conf \/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf\r\n<\/pre>\n<p>Once you had done so, open up <code>\/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf<\/code> with <code>nano<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf\r\n<\/pre>\n<p>After the editor loads the file, replace the content with the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen   80 default_server;\r\n    root \/var\/www\/projectsend-r1053;\r\n    index index.php;\r\n  \r\n    server_name ps.yourdomain.com;\r\n\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }  \r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php?$args;\r\n    }\r\n  \r\n    # pass the PHP scripts to FastCGI server \r\n    location ~ \\.php$ {\r\n        include fastcgi.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }\r\n}\r\n<\/pre>\n<p>Once you had replaced the content, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the file.<\/p>\n<p>Afterwards, 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>Using Certbot to get Let's Encrypt to issue browser-trusted SSL certificate for your domain<\/h3>\n<p>At this time, you are ready to run Certbot to get Let's Encrypt to issue browser-trusted SSL certificate for your domain. Therefore, run the following command to do so:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo certbot certonly -a webroot --webroot-path=\/var\/www\/projectsend-r1053 -d ps.yourdomain.com\r\n<\/pre>\n<h3>Generating a strong Diffie-Hellman group<\/h3>\n<p>Once Certbot had fetched the SSL certificate artefacts for your domain, generate a Diffie-Hellman group for Nginx 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<h3>Updating the Nginx configurations for serving HTTPS for your ProjectSend website<\/h3>\n<p>Now that you have the necessary artefacts for serving HTTPS, proceed on to update the Nginx configurations. Firstly, use nano to load up <code>\/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/ps.yourdomain.com.conf\r\n<\/pre>\n<p>Then, replace the content with the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen 80;\r\n    server_name  ps.yourdomain.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\/ps.yourdomain.com\/fullchain.pem;\r\n    ssl_certificate_key \/etc\/letsencrypt\/live\/ps.yourdomain.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  ps.yourdomain.com;\r\n \r\n    root \/var\/www\/projectsend-r1053;\r\n    index index.php;\r\n \r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }  \r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php?$args;\r\n    }\r\n  \r\n    # pass the PHP scripts to FastCGI server \r\n    location ~ \\.php$ {\r\n        include fastcgi.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }\r\n \r\n}\r\n<\/pre>\n<p>After that, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the configuration file.<\/p>\n<p>Once you had saved the configuration file, run the following command to restart nginx:<\/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 your domain name with HTTPs<\/h3>\n<p>Since ProjectSend had saved the base uri with the protocol scheme, you need to change it in order for ProjectSend to work properly via HTTPS. In order to do so, open up the MariaDB client:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mariadb\r\n<\/pre>\n<p>After the MariaDB client loads up, run the following SQL statement to update the base uri with https:\/\/ as the protocol scheme:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nuse myProjectSendDb;\r\nUPDATE tbl_options SET value = 'https:\/\/ps.yourdomain.com\/' WHERE name = 'base_uri';\r\n<\/pre>\n<p>After that, you will be able to access your ProjectSend site from outside your home network via HTTPS with Let's Encrypt certificate.<\/p>\n<h2>Buying the Raspberry Pi 3 hardware to host your own file sharing site<\/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=\"B07BC6WH7V\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B01F1PSFY6\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B073JYVKNX\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><input name=\"ASIN.4\" type=\"hidden\" value=\"B00N2VISLW\"><input name=\"Quantity.4\" 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<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/How-to-host-your-own-file-sharing-website-on-Raspberry-Pi-3-with-Raspbian-Stretch-Lite-Nginx-ProjectSend-MariaDB-and-PHP.jpg\" alt=\"How to host your own file sharing website on Raspberry Pi 3 with Raspbian Stretch Lite, Nginx, ProjectSend, MariaDB and PHP\" \/><\/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-4v\" 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-4v&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-4v&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%2F279&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>While <a href=\"https:\/\/www.booking.com\/hotel\/fi\/northern-lights-village.en-gb.html?aid=357004;label=gog235jc-hotel-XX-fi-northernNlightsNvillage-unspec-sg-com-L%3Aen-O%3AosSx-B%3Achrome-N%3AXX-S%3Abo-U%3AXX-H%3As;sid=2f2a77c9490aee253638a1785a67003f;dist=0&#038;sb_price_type=total&#038;type=total&#038;\" rel=\"noopener noreferrer\" target=\"_blank\">experiencing Northern Lights in Finland<\/a>, you may <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-capture-the-northern-lights-with-an-entry-level-dslr\/\" rel=\"noopener noreferrer\" target=\"_blank\">capture some Northern Lights pictures with your DSLR<\/a>. In case you want to share them with friends through your own file sharing website, have a look at <a href=\"https:\/\/www.projectsend.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">ProjectSend<\/a>. <\/p>\n<p>Since a <a href=\"https:\/\/www.amazon.com\/ELEMENT-Element14-Raspberry-Pi-Motherboard\/dp\/B07BDR5PDW\/ref=sr_1_9?s=pc&#038;ie=UTF8&#038;qid=1527832201&#038;sr=1-9\" rel=\"noopener noreferrer\" target=\"_blank\">Raspberry Pi 3<\/a> is energy efficient and affordable, you may want to setup ProjectSend on a Raspberry Pi 3. With this in mind, this post discusses how to do so with Raspbian Stretch Lite, <a href=\"http:\/\/nginx.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">Nginx<\/a>, <a href=\"https:\/\/mariadb.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">MariaDB<\/a> and <a href=\"http:\/\/php.net\/\" rel=\"noopener noreferrer\" target=\"_blank\">PHP<\/a> as the <a href=\"https:\/\/www.techcoil.com\/glossary\/lemp\" rel=\"noopener noreferrer\" target=\"_blank\">LEMP<\/a> stack.<\/p>\n","protected":false},"author":1,"featured_media":1020,"comment_status":"open","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,242,446,225,13,444,243,435,240,308,412,445,438],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/ProjectSend-r1053-setup-page.gif","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-4v","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/279"}],"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=279"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/279\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1020"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}