<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Patrick Fehr</title>
    <description>The latest articles on DEV Community by Patrick Fehr (@patrick_fehr).</description>
    <link>https://dev.to/patrick_fehr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F244660%2Ff69c6826-3aa7-4da1-a9f7-c14f6c93644e.png</url>
      <title>DEV Community: Patrick Fehr</title>
      <link>https://dev.to/patrick_fehr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/patrick_fehr"/>
    <language>en</language>
    <item>
      <title>Installing the fileserver 'filerun' on centos &amp; nginx</title>
      <dc:creator>Patrick Fehr</dc:creator>
      <pubDate>Mon, 08 Jun 2020 10:19:15 +0000</pubDate>
      <link>https://dev.to/patrick_fehr/installing-the-fileserver-filerun-on-centos-nginx-13pp</link>
      <guid>https://dev.to/patrick_fehr/installing-the-fileserver-filerun-on-centos-nginx-13pp</guid>
      <description>&lt;p&gt;Hello community&lt;/p&gt;

&lt;p&gt;This is my first post here and it expands on &lt;a href="http://blog.filerun.com/how-to-install-filerun-on-centos-8/"&gt;http://blog.filerun.com/how-to-install-filerun-on-centos-8/&lt;/a&gt;&lt;br&gt;
Basically, the linked article guides you through installing the LAMP stack and FileRun with ionCube as a simple web-accessible fileserver for up- &amp;amp; downloading.&lt;/p&gt;
&lt;h1&gt;
  
  
  Story
&lt;/h1&gt;

&lt;p&gt;As a home-server owner I just want to upload/download any type of files on my home server without depending on facebook, Amazon, Google, Microsoft or Plesk.&lt;/p&gt;
&lt;h1&gt;
  
  
   Goals
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Simple browser-accessible fileserver, localhosted (ok)&lt;/li&gt;
&lt;li&gt;Low tech stack foot print (not ok)&lt;/li&gt;
&lt;li&gt;nginx compatible, no apache (ok)&lt;/li&gt;
&lt;li&gt;Simple IAM (ok)&lt;/li&gt;
&lt;li&gt;Support for very large file uploads (not optimal)&lt;/li&gt;
&lt;li&gt;Quick installation (ok)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Summary / key takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Decided for &lt;a href="https://filerun.com/"&gt;https://filerun.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Battleground 1: Permissions (selinux)&lt;/li&gt;
&lt;li&gt;Battleground 2: Installation pre-assumes "apache" as reverse proxy and clutters installation folders with it&lt;/li&gt;
&lt;li&gt;Battleground 3: PHP7.4 is actually &lt;em&gt;not&lt;/em&gt; supported by ionCube (a filerun dependency)&lt;/li&gt;
&lt;li&gt;filerun on LAMP feels old &amp;amp; outdated, it feels like there should be newer alternatives 🤔&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Disclaimer
&lt;/h1&gt;

&lt;p&gt;These settings work for an unproxied centos8 instance for me. This should be more of a pitfalls warning/avoidance thread and not a copy/paste walkalong. I hope it's helpful, nevertheless.&lt;/p&gt;
&lt;h1&gt;
  
  
  Discovery
&lt;/h1&gt;

&lt;p&gt;First I thought, I'd use some solution in combination with tus.io (resumable uploader) but I'd have to write it myself since there is nothing mature and/or open source out there. Maybe the usecase of uploading large files is less common than I thought - and massive POST requests are still state of the art(?).&lt;/p&gt;

&lt;p&gt;So, I opened &lt;a href="https://www.reddit.com/r/selfhosted"&gt;https://www.reddit.com/r/selfhosted&lt;/a&gt; and checked out some possibilities like:&lt;br&gt;
&lt;a href="https://seatable.io"&gt;https://seatable.io&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nextcloud.com/"&gt;https://nextcloud.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/mickael-kerjean/filestash"&gt;https://github.com/mickael-kerjean/filestash&lt;/a&gt;&lt;br&gt;
I haven't checked airtable &amp;amp; matrify&lt;/p&gt;

&lt;p&gt;As it appears, the listed solutions have a big tech stack footprint or only exist as docker image.&lt;br&gt;
I like filestash but I have to still install a second local server (e.g. vsftp) and the IAM is not onboard.&lt;/p&gt;
&lt;h1&gt;
  
  
  Instructions
&lt;/h1&gt;

&lt;p&gt;So I mostly followed &lt;a href="http://blog.filerun.com/how-to-install-filerun-on-centos-8/"&gt;http://blog.filerun.com/how-to-install-filerun-on-centos-8/&lt;/a&gt;&lt;br&gt;
I skipped the apache installation &amp;amp; configuration and used my nginx config instead.&lt;br&gt;
The php-remi repository steps and the mariadb installation were straight forward.&lt;/p&gt;

&lt;p&gt;php-fpm installation:&lt;br&gt;
I didn't touch the preinstalled php.ini since it appears to be better practice to create &amp;amp; edit a /etc/php.d/01-filerun.ini which gets invoked by php, anyway.&lt;/p&gt;

&lt;p&gt;In /etc/php.d/01-filerun.ini I basically just increased the max-sizes/timeouts a bit and added the proper zend-extension line&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;memory_limit            = 50000M  
max_execution_time      = 10000
upload_max_filesize     = 50000M  
post_max_size           = 50000M  
zend_extension = /usr/lib64/php/modules/ioncube/ioncube_loader_lin_7.3.so
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then in /etc/php-fpm.d/&lt;a href="http://www.conf"&gt;www.conf&lt;/a&gt; the relevant configs - I listed the commented ones, too, because the acl entries would overwrite the owner/group lines if uncommented.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user = nginx
group = nginx
listen = /run/php-fpm/www.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
;listen.acl_users = apache,nginx
;listen.acl_groups =
listen.allowed_clients = 127.0.0.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As of 07.06.2020 ioncube_loader_lin_7.4_10.4.0_beta2.so was working only in php -v but not on the php_info() page. &lt;br&gt;
I only found through the ioncube loader-wizard.php that this meant I had to go uninstall php7.4 and go down to php7.3, great.&lt;/p&gt;

&lt;p&gt;The following steps were required because php-fpm would write the apache group into these folders:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R root:nginx /var/lib/php /usr/lib64/php
sudo chown -R nginx:nginx /var/www /var/cache/nginx/cache
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Also from within the documentation &lt;code&gt;sudo chown -R apache:apache system/data&lt;/code&gt; should be replaced with your nginx user, e.g. nginx:nginx&lt;/p&gt;

&lt;h1&gt;
  
  
   nginx configuration
&lt;/h1&gt;

&lt;p&gt;General reminder: Check the nginx logs for errors, most often, the issue you'll have is because of (selinux) permissions or some nginx configuration issue.&lt;br&gt;
Here are the relevant location blocks. I installed filerun in the folder /var/www/filerun.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user nginx;
log_format main '$document_root$fastcgi_script_name &amp;gt; $request'; # helps in finding fastcgi issues
access_log  /var/log/nginx/access.log  main;
error_log /var/log/nginx/error.log;

....

location /filerun {
    alias /var/www/filerun;
    index index.php;
    gzip on;
}

location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_param HTTP_PROXY "";
    fastcgi_pass unix:/var/run/php-fpm/www.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Debugging
&lt;/h1&gt;

&lt;p&gt;Always test(!) - and if OK - restart the nginx server after a change&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nginx -t
sudo systemctl nginx restart
sudo tail -n 20 /var/log/nginx/error.log
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;php-fpm is not as chatty, but the service should at least report that it's up &amp;amp; running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tail -n 20 /var/log/php-fpm/error.log
sudo systemctl php-fpm restart 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Sidenotes
&lt;/h1&gt;

&lt;p&gt;There is no php-imagemagick within centos8/remi anymore, instead use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo dnf install php-pecl-imagick
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>filerun</category>
      <category>nginx</category>
      <category>php</category>
      <category>centos</category>
    </item>
  </channel>
</rss>
