How to Install NextCloud on CentOS 7

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.
yum -y update
adduser nextcloud
passwd nextcloud
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
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
sudo nano /etc/php.ini
; 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
sudo nano /etc/php-fpm.d/www.conf
user = nginx
group = nginx
... ;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock
...listen.owner = nginx
listen.group = nginx
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
sudo mkdir -p /var/lib/php/session
sudo chown nginx:nginx -R /var/lib/php/session/
sudo chown nginx:nginx /var/run/php-fpm/php-fpm.sock
sudo chmod 660 /var/run/php-fpm/php-fpm.sock
sudo systemctl restart php-fpm
sudo systemctl enable php-fpm
sudo systemctl restart nginx
sudo systemctl enable nginx

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.

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.

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.

Obtain visitors’ real IP addresses: ASP, PHP, ASPX, JSP

After you connect your website to the Web Application Firewall (WAF) service, the source IP addresses of requests to your website are the WAF IP address.

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:

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store