Install NextCloud on CentOS 7 with Alibaba Cloud ECS
This article will show you how to install ** NextCloud ** on ** CentOS 7 ** using ** Alibaba Cloud ECS **.
- This blog is a translation from the English version. You can check the original from here. We use some machine translation. We would appreciate it if you could point out any translation errors. *
NextCloud is a free, open source, self-hosted service that replaces Dropbox and Google Drive. You can host your files on your private server and have full control over your data.
Prerequisites
- A new ECS instance using CentOS 7.4 as the OS.
- Connect to your ECS instance and log in as the root user.
3, the domain name directed to the ECS instance.
After logging in to 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 a user to the sudo group and switch to the newly created user.
usermod -aG wheel nextcloud
sudo su - nextcloud
Install Nginx with PHP 7
Currently, Nextcloud supports PHP versions 7.0 and 7.1. This tutorial installs PHP 7.1. Install EPEL and Remi repositories and directly install the pre-built PHP package Allows you to install.
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 the Nginx web server and PHP 7.1 with the required PHP module.
sudo yum -y install nginx php php php-fpm php-mysqlnd php-ctype php-dom php-gd php-iconv php-json php-libxml php-mbstring php-posix php-json php-libxml php-mbstring php-posix php-json php-json php-libxml php-mbstring php-mbstring php-posix 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 desired, you can use -1 as the memory limit to lift the limit on the amount of memory the script consumes. Uncomment the value of cgi.fix_pathinfo
and set it to 0 to increase the file upload limit. If you update the parameters, they should be updated as follows:
; 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
After setting up php.ini, open the php-fpm configuration file.
sudo nano /etc/php-fpm.d/www.conf
Find the user and group parameters and change from apache to nginx. Find the listen = 127.0.0.1: 9000
file, comment it out, and add listen = /var/run/php-fpm/php-fpm.sock
just below it. Finally, uncomment listen.owner and change its value from nobody to nginx. After updating the parameters, it should be updated as follows.
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 it to enable the php environment variable.
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 the editor. Now create a new directory to store your PHP session data.
sudo mkdir -p /var/lib/php/session
sudo chown nginx:nginx -R /var/lib/php/session/
Set the appropriate permissions and ownership on the 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
After that, start php-fpm so that it will start automatically at startup.
sudo systemctl restart php-fpm
sudo systemctl enable php-fpm
Also, start the Nginx web server so that it starts automatically at startup.
sudo systemctl restart nginx
sudo systemctl enable nginx
This completes the Nginx installation. Download NextCloud, configure SSL, configure MySQL database, complete web-based installation, this Tutorial Set up the Cron job as shown.
Related blog articles
How to configure PHP on Ubuntu 16.04
PHP is one of the most widely used server-side scripting languages. An open source general-purpose programming language is a powerful tool for running dynamic and interactive web applications.
In this article, you will get information about installing some tools using PHP on Ubuntu 16.04.
How to install ClipBucket and Nginx on CentOS 7
ClipBucket does not restrict installation on any particular operating system (OS). You can use your favorite OS, but the installation procedure differs depending on the OS.
In this tutorial, you will install and configure ClipBucket and Nginx on an Alibaba Cloud Elastic Compute Service (ECS) instance using CentOS 7.
Related market products
Some products with PHP infrastructure and Centos built by partner companies can be launched immediately on Alibaba Cloud servers.
PHP infrastructure using Websoft9 (LAMP | CentOS7.2)
The Websoft9 LAMP stack is a pre-configured, executable image for running PHP applications on Alibaba Cloud.
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 Red Hat Enterprise Linux (RHEL) sources. CentOS is fully compliant with upstream vendor redistribution policies and aims to be 100% functionally compatible with RHEL (CentOS primarily modifies packages for upstream vendor branding and art. The work is being deleted). CentOS Linux can be redistributed free of charge.
related documents
Some documentation may be helpful.
Change PHP version
Web hosting supports PHP and uses PHP 5.3 by default.
If the default PHP version is different from what your program requires, you can change the PHP version.
Building LNMP environment on CentOS 7
NGINX is a small and efficient web server software for Linux. With NGINX, you can easily build an LNMP web service environment. The LNMP environment is based on the four main components required for this architecture. Linux, NGINX, MySQL, PHP. This topic describes how to manually build an LNMP environment on your ECS instance.
related products
Web Hosting
Web hosting is used to store and host website content and behaves like a virtual server. ECS instances are divided into multiple spaces that can be of various sizes. The space corresponds to your account and indicates an instance of web hosting. Each space has independent FTP and web permissions, but all spaces share the hardware resources of the ECS instance.
Web Application Firewall
Web Application Firewall (WAF) protects your website’s servers from intrusion. Our services detect and block malicious traffic directed to your website or application. WAF protects your core business data and prevents server malfunctions due to malicious activity or attacks.
Related courses
Deep dive in attack and defense of web applications
Web applications are the most common way to serve services in the cloud and are the most vulnerable security targets. Through this course, you will be able to understand the top 10 security risks of network applications listed by OWASP. We will explain these 10 security risks one by one, select the three most common attack methods, XSS, SQL injection, and Webshell, and have a deeper discussion. Finally, we will introduce the WAF products of Alibaba Cloud. You can solve the security problems of online applications.
How to troubleshoot problems with web hosting services
This video will show you how to find and resolve database connectivity issues.
Database connection problem
DNS record problem
Invalid response problem
- Alibaba Cloud is the No. 1 (2019 Gartner) cloud infrastructure operator in the Asia-Pacific region with two data centers in Japan and more than 60 availability zones in the world.
Click here for more information on Alibaba Cloud.
Alibaba Cloud Japan Official Page *