NextCloud through Nginx Entware

Tested on RT-AC86U running firmware v384.17 on 06.05.2020


1
 - Setup Entware-NG from this guide

2 - Install Nginx Web Server from this guide

3 - Install necessary packages:

opkg install bzip2 coreutils-stat \
php7-cgi php7-cli php7-mod-ctype php7-mod-curl php7-mod-dom php7-mod-fileinfo \
php7-mod-filter php7-mod-gd php7-mod-iconv php7-mod-intl php7-mod-json \
php7-mod-mbstring php7-mod-mysqli php7-mod-openssl php7-mod-pcntl php7-mod-pdo \
php7-mod-pdo-mysql php7-mod-pdo-sqlite php7-mod-session php7-mod-simplexml \
php7-mod-sqlite3 php7-mod-xml php7-mod-xmlreader php7-mod-xmlwriter \
php7-mod-zip openssl-util php7-mod-opcache php7-mod-bcmath php7-mod-gmp

4 - Download and install latest version of NextCloud

cd /opt/share/nginx/html
wget https://download.nextcloud.com/server/releases/nextcloud-19.0.3.tar.bz2 --no-check-certificate
bzip2 -cd nextcloud-19.0.3.tar.bz2 | tar -xv
rm ./nextcloud-19.0.3.tar.bz2
chown admin:root -R /opt/share/nginx/html/nextcloud/*

5 - Enable NextCloud log

mkdir -p /opt/etc/nginx/conf.d
cat >> /opt/etc/nginx/conf.d/nextcloud.conf << 'EOF'
access_log /opt/var/log/nginx/nextcloud.access.log;
error_log /opt/var/log/nginx/nextcloud.error.log warn;
EOF

Press Enter

6 - Increase upload max filesize, post max size and limit memory to 128Mb by modifying php configuration file

sed -i "/upload_max_filesize =*/cupload_max_filesize = 5G" "/opt/etc/php.ini"
sed -i "/post_max_size =*/cpost_max_size = 5G" "/opt/etc/php.ini"
sed -i "/memory_limit =*/cmemory_limit = 128M" "/opt/etc/php.ini"
sed -i "/max_input_time =*/cmax_input_time = 300" "/opt/etc/php.ini"

7 - Restart Nginx and php-cgi

/opt/etc/init.d/S80nginx restart
/opt/etc/init.d/S80php-cgi restart

8 - Now access nextcloud through router default ip address and port 82 www.asusrouter.com:82/nextcloud

9 - Chose a username & a strong password, then press "Finish Setup"

10 - Access NextCloud from lanwan or https-lan, https-wan ip address

Source SNB

Thanks @ryzhov_al & @zyxmon