×
Community Blog How to Install NextCloud on CentOS 7

How to Install NextCloud on CentOS 7

In this article, you will get some information on the installation of NextCloud on CentOS 7 with Alibaba Cloud ECS.

NextCloud is a free and open source self-hosted alternative to Dropbox or Google Drive. It lets you host your files onto your own private server, providing you full control over your data.

Prerequisite

  1. A new ECS instance with CentOS 7.4 as the operating system.
  2. Connect to your ECS instance and log in as the root user.
  3. A domain name which is pointed towards your ECS instance.

Once you are logged into your CentOS 7 instance, run the following command to update your base system with the latest available packages.

yum -y update

Create a new user.

adduser nextcloud
passwd nextcloud

Add the user to sudo group and switch to the newly created user.

usermod -aG wheel nextcloud
sudo su - nextcloud

Install Nginx with PHP 7

As of now, Nextcloud supports PHP version 7.0 and 7.1. In this tutorial, we will install PHP 7.1. Install EPEL and Remi repository so that we can install the pre-built PHP packages directly.

sudo yum -y install epel-release yum-utils nano unzip
sudo rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php71

Install Nginx web server and PHP 7.1 along with the required PHP modules.

sudo yum -y install nginx php php-fpm php-mysqlnd php-ctype php-dom php-gd php-iconv php-json php-libxml php-mbstring php-posix php-xml php-zip php-openssl php-zlib php-curl php-fileinfo php-bz2 php-intl php-mcrypt php-ftp php-exif php-gmp php-memcached php-imagick

Edit the loaded PHP configuration file.

sudo nano /etc/php.ini

Set the appropriate time zone and memory limit. If you want, you can use -1 as the memory limit, which will remove the limits on the amount of memory a script may consume. Uncomment and set 0 to the value of cgi.fix_pathinfo and increase the file upload limits. Once you have updated the parameters, the updates should look like as shown below.

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M

...    
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =Asia/Kolkata

...
cgi.fix_pathinfo=0

...
post_max_size = 512M

...
upload_max_filesize = 512M

Once you have done configuring php.ini, open the php-fpm configuration file.

sudo nano /etc/php-fpm.d/www.conf

Look for the user and group parameters and change it from apache to nginx. Find listen = 127.0.0.1:9000 file to comment it out and append listen = /var/run/php-fpm/php-fpm.sock just below it. Finally, uncomment listen.owner and change its value from nobody to nginx. Once you have updated the parameters, the updates should look like as shown below.

user = nginx
group = nginx

...    

;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock

...

listen.owner = nginx
listen.group = nginx

Also, search for the following line and uncomment them to enable php environment variables.

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Save the file and exit from the editor. Now create a new directory to store the PHP session data.

sudo mkdir -p /var/lib/php/session
sudo chown nginx:nginx -R /var/lib/php/session/

Set appropriate permission and ownership to php-fpm socket file.

sudo chown nginx:nginx /var/run/php-fpm/php-fpm.sock
sudo chmod 660 /var/run/php-fpm/php-fpm.sock

Now, start php-fpm and enable it to automatically start at boot time.

sudo systemctl restart php-fpm
sudo systemctl enable php-fpm

Also, start Nginx web server and enable it to automatically start at boot time.

sudo systemctl restart nginx
sudo systemctl enable nginx

Now you have installed Nginx with php 7 successfully, then you can download NextCloud, setup SSL, setup mySql database, finalize the web-based installation and configure Cron Job as this tutorial shows.

Related Blog Posts

How to Setup PHP on Ubuntu 16.04

PHP is one of the most widely used server-side scripting language. The open source general purpose programming language is powerful for running dynamic and interactive web applications.

In this article, you will get some information on the installation of some tools with php on Ubuntu 16.04.

How to Install ClipBucket and Nginx on CentOS 7

ClipBucket does not restrict its installation to any specific operating system (OS). You can use any operating system (OS) of your choice; however, the installation steps would vary according to the choice of operating system.

In this tutorial, we will be installing and configuring ClipBucket and Nginx on an Alibaba Cloud Elastic Compute Service (ECS) instance with CentOS 7.

Related Market Products

There are some products with php infrastructures and centos built by partners can be quickly launched on Alibaba Cloud servers.

PHP infrastructure powered by Websoft9( LAMP | CentOS7.2)

Websoft9 LAMP stack is a pre-configured, ready to run image for running PHP application on Alibaba Cloud.it includes new versions of Apache, MySQL, PHP,phpMyAdmin and other components needed for it. it clould help you simplifies the development and deployment of Web applications.

CentOS 7.0 64bit

The CentOS image was officially applied and tested by Alibaba Cloud. The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). CentOS conforms fully with the upstream vendor's redistribution policy and aims to be 100% functionally compatible with RHEL (CentOS mainly changes packages to remove upstream vendor branding and artwork). CentOS Linux is no-cost and free to redistribute.

Related Documentation

There are some documentation may be useful to you.

Change the PHP version

Web Hosting supports PHP and uses PHP 5.3 by default.

If the default PHP version is different from what is required by your program, you can change the PHP version.

Build an LNMP environment on CentOS 7

NGINX is a small and efficient Web server software for Linux. NGINX allows you to easily build an LNMP Web service environment. The LNMP environment is based on four major components required in this architecture: Linux, NGINX, MySQL, and PHP. This topic describes how to manually build the LNMP environment on an ECS instance.

Related Products

Web Hosting

Web Hosting is used to store and host website content, and operates similarly to virtual servers. An ECS instance is divided into multiple spaces that can be of various sizes. A space corresponds to an account, and indicates a Web Hosting instance. Each space has an independent FTP and web access permission, but all spaces share the hardware resources of the ECS instance.

Web Application Firewall

Web Application Firewall (WAF) protects your website servers against intrusions. Our service detects and blocks malicious traffic directed to your websites and applications. WAF secures your core business data and prevents server malfunctions caused by malicious activities and attacks.

Related Course

Web Application Attacks and Defense Deep Dive

Web applications are the most common way to provide services on the cloud and are the most vulnerable security targets. Through this course, you can understand the top 10 network application security risks listed by OWASP. We will explain these 10 security risks one by one, and choose XSS, SQL injection, Webshell, the three most common attack methods to further in-depth discussion, and finally introduce Alibaba Cloud's WAF products to help you solve online application security problems once and for all.

How to Troubleshoot Web Hosting Service Issues

This video will show how to find and resolve:

Database Connection Issue
DNS Record Issue
Invalid Response Issue

0 0 0
Share on

Alibaba Clouder

2,599 posts | 762 followers

You may also like

Comments