This is an old revision of the document!
Table of Contents
How to Install Nextcloud with Nginx and Let's Encrypt SSL on Ubuntu 20.04 LTS
https://www.howtoforge.com/tutorial/ubuntu-nginx-nextcloud/
Prerequisites
- List ItemUbuntu 20.04
- Root privileges
- ItemWhat we will do
- Install Nginx Webserver
- Install and Configure PHP7.4-FPM
- Install and Configure MySQL Server
- Generate SSL Letsencrypt
- Download Nextcloud 18
- Configure Nginx Virtual Host for Nextcloud
- UFW Firewall Configuration
- Nextcloud Post-Installation
Step 1 - Install Nginx Webserver
The first step we will do in this nextcloud guide is to install the Nginx web server. We will be using the Nginx web server instead of Apache webserver.
Log in to the server and update the repository, then install the Nginx web server using the apt command as shown below.
sudo apt update sudo apt install nginx -y
After the installation is complete, start the Nginx service and enable the service to launch every time at system boot using systemctl.
systemctl start nginx systemctl enable nginx
The Nginx service is up and running, check it using the following command.
systemctl status nginx
As a result, the Nginx web server has been installed on Ubuntu 20.04.
Step 2 - Install and Configure PHP7.4-FPM
By default, the Ubuntu 20.04 comes with default version PHP 7.4.
Install PHP and PHP-FPM packages needed by Nextcloud using the apt command below.
sudo apt install php-fpm php-curl php-cli php-mysql php-gd php-common php-xml php-json php-intl php-pear php-imagick php-dev php-common php-mbstring php-zip php-soap php-bz2 -y After the installation is complete, we will configure the php.ini files for php-fpm and php-cli.
Go to the '/etc/php/7.4' directory.
cd /etc/php/7.4/
Edit the php.ini files for php-fpm and php-cli using vim.
vim fpm/php.ini vim cli/php.ini
Uncomment the 'date.timezone' line and change the value with your own timezone.
date.timezone = North_America/New_York
Uncomment the 'cgi.fix_pathinfo' line and change the value to '0'.
cgi.fix_pathinfo=0
Save and exit.
Next, edit the php-fpm pool configuration 'www.conf'.
vim fpm/pool.d/www.conf
Uncomment those lines below.
env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp
Save and exit.
Restart the PHP7.4-FPM service and enable it to launch every time on system boot.
systemctl restart php7.4-fpm systemctl enable php7.4-fpm
Now check the PHP-FPM service using the following command.
</code> ss -xa | grep php systemctl status php7.4-fpm </code>
And you will get the php-fpm is up and running under the sock file '/run/php/php7.4-fpm.sock'.