1

How to Install WonderCMS on Debian 9

 2 years ago
source link: https://www.vultr.com/docs/how-to-install-wondercms-on-debian-9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
<?xml encoding="utf-8" ??>

WonderCMS is an open source, fast and small flat file CMS written in PHP. WonderCMS source code is hosted on Github. This guide will show you how to install WonderCMS on a fresh Debian 9 Vultr instance with Nginx as a web server.

Requirements

  • PHP version 7.1 or greater with the curl, mbstring and zip extensions.
  • Web server such as Apache with the mod_rewrite module enabled, Nginx or IIS. This guide will use Nginx.

Before you begin

Check the Debian version.

lsb_release -ds
# Debian GNU/Linux 9.7 (stretch)

Ensure that your system is up to date.

apt update && apt upgrade -y

Install some basic system administration packages if they are not installed.

apt install -y vim sudo curl wget git unzip bash-completion apt-transport-https lsb-release ca-certificates dirmngr

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Install PHP

Add ppa:ondrej/php to your system's software sources.

sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Install PHP, as well as the necessary PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-curl php7.2-zip php7.2-mbstring

Check the version.

php --version

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v

Run sudo vim /etc/nginx/sites-available/wondercms.conf and configure Nginx for WonderCMS.

server {

  listen 80;

  server_name example.com;
  root /var/www/wondercms;

  index index.php;


  location / {
    if (!-e $request_filename) {
      rewrite ^/(.+)$ /index.php?page=$1 last;
    }
  }
  location ~ database.js {
    return 403;
  }

  location ~ \.php(/|$) {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  }

}

Save the file and exit.

Activate the new wondercms.conf configuration by linking the file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/wondercms.conf /etc/nginx/sites-enabled/

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install WonderCMS

Create a document root directory.

sudo mkdir -p /var/www/wondercms

Change ownership of the /var/www/wondercms directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/wondercms

Navigate to the document root folder.

cd /var/www/wondercms

Download and unzip WonderCMS.

wget https://github.com/robiso/wondercms/releases/download/2.6.0/WonderCMS-2.6.0.zip
unzip WonderCMS-2.6.0.zip
rm WonderCMS-2.6.0.zip

Move WonderCMS files to the document root directory.

mv wondercms/* . && mv  wondercms/.* .
rmdir wondercms

Change ownership of the /var/www/wondercms directory to www-data.

sudo chown -R www-data:www-data /var/www/wondercms

Open your site in a web browser and log in with the default password admin and change the default password afterward.

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK