debian 9 | LinuxHostSupport Linux Tutorials and Guides Tue, 20 Jul 2021 12:27:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 How To Speed Up a Website on Debian 9 https://linuxhostsupport.com/blog/how-to-speed-up-a-website-on-debian-9/ https://linuxhostsupport.com/blog/how-to-speed-up-a-website-on-debian-9/#respond Thu, 15 Jul 2021 17:30:26 +0000 https://linuxhostsupport.com/blog/?p=1414 Speeding up a website is a very important process because most of the visitors will leave a slow website and visit a competitor’s website instead of suffering a delay. Also, they would not return to a website with poor loading speed. A faster page load speed gives visitors a better user experience. The impact of […]

The post How To Speed Up a Website on Debian 9 appeared first on LinuxHostSupport.

]]>
speed up website debian 9Speeding up a website is a very important process because most of the visitors will leave a slow website and visit a competitor’s website instead of suffering a delay. Also, they would not return to a website with poor loading speed. A faster page load speed gives visitors a better user experience. The impact of website speed is huge on search engine rankings too. If you strive to achieve good rankings on search engines, make sure to optimize your website for speed. Before we start working on improving the website speed, it is a good idea to know what is an acceptable web page speed. In general, the best practice is around three seconds.

There are many different steps we can take to increase website speed and improve user experience. In this guide, we will show you how to speed up a website on a Debian 9 VPS.

Listed below are the most efficient ways to increase the website speed:

Enable GZIP compression

Enabling website compression allows the web page to load faster, so if you have Apache2 installed and running on your Debian VPS, enable Gzip module (mod_deflate) using the following command:

sudo a2enmod deflate

Restart the Apache service for the changes to take effect:

service apache2 restart

Create a .htaccess file in the document root directory of your website (or modify it if it exists) and add the following code in it:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

Enable Expires Header to static resources

When visiting a website, the website will cache in the visitor’s web browser. Adding Expires headers to static resources is useful because it reduces the web page loading speed for subsequent page views/return visits from returning visitors. In order to enable Expires headers to static resources, we need to add the following code in the .htaccess file:

ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000

Where A2592000 means 1 month.

Use a Content Delivery Network (CDN)

Using a CDN is a great way to achieve a better user experience and reduce the load speed of a website. When using a CDN, the website files are cached on many servers in different locations of the world and whenever a visitor accesses your website, the requests to your website are served from a nearby server.

Use advanced caching mechanisms

Use a caching mechanism that works efficiently to optimize your website for speed. By enabling a caching mechanism, we can reduce the time it takes for repeat visitors to load the website. Depending on the website content (static, dynamic, and/or database-driven), we can install and use Varnish, Redis, Memcached, etc. All caching mechanisms allow web applications to store data and recall it from memory very fast. Also, if you use a CMS on your website, try to install a caching plugin/extension.

Minify JavaScript and CSS files

Minify all JavaScript files over 4 KB of size.

Remove all unused CSS code. Minify the CSS code by stripping out unnecessary characters and spaces thus reduce its file size.

Load the CSS code inside the <head> element, and JavaScript code inside the <body>, usually to the bottom of your web pages.

Optimize Images

Larger images take longer to download than smaller ones. Try to use smaller images, and keep the number of images to an absolute minimum. Use images in an appropriate format. such as JPG, SVG, PNG, and GIF format.

Optimize the database

To optimize the website loading time, it is important to optimize the MySQL database used by your website too.

If you use a MySQL database on your website, use the following command to optimize it:

mysqlcheck -u<db_user> -p -o <db_name>

Replace <db_user> with the actual MySQL username and <db_name> with your MySQL database name respectively.

Remove Unnecessary Plugins and Add-ons

speed up website debian 9If you use a CMS on your website, try to delete all unused themes, extensions, plugins, add-ons, etc. Of course, you don’t have to speed up your website on Debian 9, if you use one of our Linux server management services, in which case you can simply ask our expert Linux admins to help you speed up and optimize your website for you. They are available 24×7 and will take care of your request immediately.

If you liked this post, on how to speed up your website on Debian 9, please share it with your friends on the social networks using the buttons below or simply leave a reply in the comments section.

The post How To Speed Up a Website on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-speed-up-a-website-on-debian-9/feed/ 0
How to Install Docker Compose on Debian 9 https://linuxhostsupport.com/blog/how-to-install-docker-compose-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-docker-compose-on-debian-9/#respond Fri, 18 Dec 2020 11:28:27 +0000 https://linuxhostsupport.com/blog/?p=1311 Docker is an open-source application that provides lightweight operating-system-level virtualization through the use of containers. The key benefit of Docker is that it allows users to package an application with all of its dependencies into a standardized unit for software development. Docker Engine is available in Community Edition (CE) and Enterprise Edition (EE). In this […]

The post How to Install Docker Compose on Debian 9 appeared first on LinuxHostSupport.

]]>
installing docker compose on debian 9 Docker is an open-source application that provides lightweight operating-system-level virtualization through the use of containers. The key benefit of Docker is that it allows users to package an application with all of its dependencies into a standardized unit for software development.

Docker Engine is available in Community Edition (CE) and Enterprise Edition (EE). In this guide, we will do the installation of Docker Community Edition on Debian 9.

Requirements

  • For the purposes of this tutorial, we will be using a Debian 9 Server.
  • Full SSH root access or a user with sudo privileges is also required.

Step 1: Connect via SSH

Connect to your server via SSH as the root user using the following command:

ssh root@IP_ADDRESS -p PORT_NUMBER

Remember to replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number. Replace “root” with your admin username if you’re not planning on using the root account.

Before starting with the installation, we need to update the OS packages to their latest versions.

We can do this by running the following commands:

$ apt-get update 
$ apt-get upgrade

Once the upgrade is complete, we can move on to the next step.

Step 2: Install Dependency packages

Start the installation by ensuring that all the packages used by docker as dependencies are installed.

apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common build-essential

Step 3: Setting Up Docker Repository

To add the Docker repository to our server, we need to add the GPG keys first with the following commands:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

Once added, add the repository pointing to ‘stable’ update channel.

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

We can now update our packages, which should include the repository from Docker.

apt-get update

After applying the command, you should see the repository link added:

Get:5 https://download.docker.com/linux/debian stretch InRelease [44.8 kB]
Get:7 https://download.docker.com/linux/debian stretch/stable amd64 Packages [8,437 B]

Step 4: Installing Docker CE

After setting up the repository, we can now install the Docker CE, as well as the Docker CLI by running the following command:

apt-get install -y docker-ce docker-ce-cli

This might take some time as it will also install any additional libraries that it requires.

Once the installation is done, verify that the docker service is running by typing:

systemctl status docker

Output:

docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-07-14 03:40:16 EDT; 38s ago
     Docs: https://docs.docker.com
 Main PID: 4434 (dockerd)
   CGroup: /system.slice/docker.service
           └─4434 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

You can also check and verify the Docker version using:

docker -v

Output:

Docker version 18.09.7, build 2d0083d

Finally, make sure that the docker service will run at boot:

systemctl enable docker

The docker the group is created but no users are added. Add normal user to the group to run docker commands as a non-privileged user.

sudo usermod -aG docker $USER

Step 5: Testing Docker CE

Let’s now test if we can run Docker containers. You can test your Docker installation by running the classic “Hello World”.

$ docker run hello-world

Hello from Docker.
This message shows that your installation appears to be working correctly.
...

You can use the docker images a command to see a list of all images on your system.

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        6 months ago        1.84kB

The docker ps command shows you all containers that are currently running.

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Since no containers are running, we see a blank line. Let’s try a more useful variant: docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1a9048235446        hello-world         "/hello"            24 minutes ago      Exited (0) 24 minutes ago                       amazing_bassi

Throughout this tutorial, you will run multiple times, and leaving stray containers will eat up disk space. Hence, as a rule of thumb, I clean up containers once I’m done with them. To do that, you can run the docker rm command. Just copy the container IDs from above and paste them alongside the command.

docker rm 1a9048235446
1a9048235446

In later versions of Docker, the docker container prune command can be used to achieve the same effect.

$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y

If you want to see the options available to a specific command execute the following command:

docker --help

The output should be similar to this:

install docker compose on debian 9

That’s it! Docker CE has been successfully installed on your Debian 9 server.


docker installation on debian 9Of course, you don’t need to do any of this if your server is covered by our Managed Linux Support services in which case you can simply ask our expert Linux admins to install Docker CE onto your server for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, please share it with your friends on the social networks using the buttons below, or simply leave a comment in the comment section. Thanks.

The post How to Install Docker Compose on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-docker-compose-on-debian-9/feed/ 0
How to Install Apache Kafka on Debian 9 https://linuxhostsupport.com/blog/how-to-install-apache-kafka-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-apache-kafka-on-debian-9/#respond Wed, 15 Jul 2020 18:58:54 +0000 https://linuxhostsupport.com/blog/?p=1199 In this guide, we will show you how to install Apache Kafka on a Debian 9 VPS. Apache Kafka is a free and open-source distributed streaming software platform that lets you publish and subscribe to streams of records and store streams of records in a fault-tolerant and durable manner. Apache Kafka is written in Scala […]

The post How to Install Apache Kafka on Debian 9 appeared first on LinuxHostSupport.

]]>
In this guide, we will show you how to install Apache Kafka on a Debian 9 VPS.

Apache Kafka is a free and open-source distributed streaming software platform that lets you publish and subscribe to streams of records and store streams of records in a fault-tolerant and durable manner. Apache Kafka is written in Scala and Java. Used in thousands of companies across the world, Apache Kafka provides anyone with the ability to create streaming and stream processing applications that can read and store data in real time. This has a variety of use cases – anything from logging, to messaging, to processing almost any sort of data stream you could imagine. Let’s get started with the installation.

In order to run Apache Kafka on your VPS, the following requirements have to be met:

  • Java 8 or higher needs to be installed
  • ZooKeeper installed and running on the server
  • A VPS with at least 4GB of RAM

If you don’t have Java or ZooKeeper, don’t worry, we’ll be installing them in this tutorial as well.

Step 1 – Update OS Packages

Before we can start with the Apache Kafka installation, we have to make sure that all Debian OS packages that are installed on the server are up to date. We can do this by executing the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 2 – Install JAVA

In order to run Apache Kafka on our server, we’ll need to have Java installed. We can check if Java is already installed using this command:

which java

If there is no output, that means that Java is not installed on the server yet. We can install it using the following command:

sudo apt-get install default-jdk

In order to check the Java version, run the following command on your server:

java -version

We should receive the following output:

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

Step 3 – Install Zookeeper

Kafka uses ZooKeeper to store persistent cluster metadata, so we need to install ZooKeeper. The ZooKeeper service is responsible for configuration management, leader detection, synchronization, etc. ZooKeeper is available in the official Debian package repository, so we can install it using the following command:

sudo apt-get install zookeeperd

ZooKeeper is running on port 2181 and it doesn’t require much maintenance.

Step 4 – Install Apache Kafka

Crate a new system user dedicated for the Kafka service using the following command (we’re using the kafka name for our username, you can use any name you like):

useradd kafka -m

Set a password for the newly created user:

passwd kafka

Use a strong password and enter it twice. Next, add the user to the sudo group with:

adduser kafka sudo

Stop the ZooKeeper service:

systemctl stop zookeeper.service

Log in as the newly created admin user with:

su kafka

Download the latest version of Apache Kafka available at https://kafka.apache.org/downloads and extract it in a directory on your server:

cd ~
wget -O kafka.tgz http://apache.osuosl.org/kafka/2.1.0/kafka_2.12-2.1.0.tgz
tar -xvzf kafka.tgz
mv kafka_2.12-2.1.0/* .
rmdir /home/kafka/kafka_2.12-2.1.0

Edit the ZooKeeper systemd script:

vi /lib/systemd/system/zookeeper.service
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Type=simple
User=kafka
ExecStart=/home/kafka/bin/zookeeper-server-start.sh /home/kafka/config/zookeeper.properties
ExecStop=/home/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal

[Install]
WantedBy=multi-user.target

Create a systemd unit file for Apache Kafka, so that you can run Kafka as a service on your server:

vi /etc/systemd/system/kafka.service

Add the following lines:

[Unit]
Requires=network.target remote-fs.target zookeeper.service
After=network.target remote-fs.target zookeeper.service

[Service]
Type=simple
User=kafka
ExecStart=/home/kafka/bin/kafka-server-start.sh /home/kafka/config/server.properties
ExecStop=/home/kafka/bin/kafka-server-stop.sh
Restart=on-abnormal

[Install]
WantedBy=multi-user.target

Edit the server.properties file and add/modify the following properties:

vi /home/kafka/config/server.properties
listeners=PLAINTEXT://:9092
log.dirs=/var/log/kafka

After we make changes to a unit file, we should always run the systemctl daemon-reload command:

systemctl daemon-reload

Create a new directory called kafka in the /var/log/ directory on your server:

mkdir -p /var/log/kafka
chown kafka:kafka -R /var/log/kafka

This can be useful for troubleshooting. Then, start the ZooKeeper and  Apache Kafka services:

systemctl start zookeeper.service
systemctl start kafka.service

Enable the Apache Kafka service to automatically start on server boot:

systemctl enable kafka.service

In order to check if ZooKeeper and Kafka services are up and running, run the following command on your VPS:

systemctl status zookeeper.service

We should then receive an output similar to this:

zookeeper.service
Loaded: loaded (/lib/systemd/system/zookeeper.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-12-19 06:23:33 EST; 25min ago
Main PID: 20157 (java)
Tasks: 21 (limit: 4915)
CGroup: /system.slice/zookeeper.service
└─20157 java -Xmx512M -Xms512M -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/home/kafka/bin/../l

Run this command next:

systemctl status kafka.service

The output of this command should be similar to this one:

kafka.service
Loaded: loaded (/etc/systemd/system/kafka.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2018-12-19 06:46:49 EST; 27s ago
Process: 22520 ExecStop=/home/kafka/bin/kafka-server-stop.sh (code=exited, status=0/SUCCESS)
Main PID: 22540 (java)
Tasks: 62 (limit: 4915)
CGroup: /system.slice/kafka.service
└─22540 java -Xmx1G -Xms1G -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/home/kafka/bin/../logs/

We can also use netstat command to check if Kafka and ZooKeeper services are listening on ports 9092 and 2181, respectively:

netstat -tunlp | grep -e \:9092 -e \:2181
tcp6       0      0 :::9092                 :::*                    LISTEN      22540/java
tcp6       0      0 :::2181                 :::*                    LISTEN      20157/java

If they are both running, and both ports are open and listening, then that is all. We have successfully installed Apache Kafka.


Of course, you don’t have to install and configure Apache Kafka on Debian 9 if you use one of our Managed Debian Support solutions, in which case you can simply ask our expert Linux admins to setup and configure Apache Kafka on Debian 9 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Apache Kafka on a Debian 9 VPS, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

The post How to Install Apache Kafka on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-apache-kafka-on-debian-9/feed/ 0
How to Install WildFly 14 on Debian 9 https://linuxhostsupport.com/blog/how-to-install-wildfly-14-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-wildfly-14-on-debian-9/#comments Wed, 17 Oct 2018 09:18:14 +0000 https://linuxhostsupport.com/blog/?p=720 We’ll show you how to install WildFly 14 on Debian 9 with Apache as a reverse proxy. WildFly is free and open-source Java application server formerly known as JBoss. It is written in Java and used for building deploying and hosting Java applications and other web-based applications and services. 1. WildFly Requirements In order to […]

The post How to Install WildFly 14 on Debian 9 appeared first on LinuxHostSupport.

]]>
installing wildfly 14 on debian 9We’ll show you how to install WildFly 14 on Debian 9 with Apache as a reverse proxy. WildFly is free and open-source Java application server formerly known as JBoss. It is written in Java and used for building deploying and hosting Java applications and other web-based applications and services.

1. WildFly Requirements

In order to run WildFly on your Debian 9 server, you need the following requirements:

  • Java SE 8 or later (we recommend that you use the latest update available) installed on your Debian 9 virtual server
  • Debian 9 VPS with root access enabled.

2. Log in via SSH and Update your System

First, you will need to log in to your Debian 9 VPS via SSH as the root user:

ssh root@IP_ADDRESS -p PORT_NUMBER

and as usual, run the following commands to upgrade all installed OS packages on your VPS:

apt-get update
apt-get upgrade

3.  Install Java

Java is not pre-installed on Debian 9 by default.

To install the Java Developer Kit (JDK),  execute this command on the VPS:

apt-get install default-jdk

To find out what version of Java has been installed, run:

java -version

The output should look something like this:

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

 

4.  Install WildFly

cd /opt
wget http://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
tar -xvzf wildfly-14.0.1.Final.tar.gz
mv wildfly-14.0.1.Final wildfly

5. Create a WildFly User

Create a new system user named wildfly:

groupadd -r wildfly
useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

6. Configure WildFly

Create a new WildFly configuration file:

vi /etc/default/wildfly

Add the following lines:

WILDFLY_USER="wildfly"
STARTUP_WAIT=180
SHUTDOWN_WAIT=30
WILDFLY_CONFIG=standalone.xml
WILDFLY_MODE=standalone
WILDFLY_BIND=0.0.0.0

so it will start WildFly 14 using the default web profile configuration in ‘standalone’ mode.

Create a WildFly startup script, named ‘launch.sh’:

vi /opt/wildfly/bin/launch.sh

Add the following lines:

#!/bin/sh

if [ "x$WILDFLY_HOME" = "x" ]; then
    WILDFLY_HOME=/opt/wildfly
fi

if [ "x$1" = "xdomain" ]; then
    echo 'Starting Wildfly in domain mode.'
    $WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
    echo 'Starting Wildfly in standalone mode.'
    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
fi

Make the startup script executable:

chmod 755 /opt/wildfly/bin/launch.sh

Create a systemd init file for WildFly, named wildfly.service:

vi /etc/systemd/system/wildfly.service

Add the following lines:

[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=apache2.service

[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=/etc/default/wildfly
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null

[Install]
WantedBy=multi-user.target

Run the following command to reload units from disk:

systemctl daemon-reload

Set the proper ownership of files and directories located in the /opt/wildfly directory:

chown wildfly:wildfly -R /opt/wildfly/

Start the WildFly service:

systemctl start wildfly

Enable WildFly to start automatically on boot:

systemctl enable wildfly

6. Set up a Reverse Proxy in Apache

In order to access your WildFly application only by using your domain name, without the port number in the URL, we need to set up Apache as a reverse proxy.

To do so, we will need to enable some additional proxy modules in Apache. We can do this using the following commands:

a2enmod proxy
a2enmod proxy_http

Once this is done, create a new Apache configuration file for your domain with the following command:

vi /etc/apache2/sites-available/your-domain.conf

And enter the following:

<VirtualHost *:80>
ServerName your-domain.com
ServerAlias www.your-domain.com

ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>

Save the file and close it.

There are two ways to enable the ‘your-domain.conf’ configuration in Apache. We can use:

a2ensite your-domain.com.conf

Alternatively, we can accomplish the same using:

ln -s /etc/apache2/sites-available/your-domain.conf /etc/apache2/sites-enabled/your-domain.conf

Do not forget to replace your ‘your-domain.com’ with your actual domain name.

Disable the default Apache configuration file:

rm /etc/apache2/sites-enabled/000-default.conf

Restart Apache for the changes to take effect:

service apache2 restart

WildFly has a powerful web-based administration console. In order to access the WildFly management console, we have to add a new user. Run the add-user.sh script within the bin directory of the WildFly installation:

/opt/wildfly/bin/add-user.sh

Select: a) Management User , enter a username and password for the WildFly management user.

Edit the /opt/wildfly/standalone/configuration/standalone.xml WildFly configuration file and replace:

<interface name=”management”>
<inet-address value=”${jboss.bind.address.management:127.0.0.1}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:0.0.0.0}”/>
</interface>
with:
<interface name=”management”>
<any-address/&gt;
</interface>
<interface name=”public”>
<any-address/>
</interface>
Restart WildFly for the changes to take effect:

systemctl restart wildfly

Open http://your-domain.com and access the WildFly management console using the newly created user login credentials.

 Install WildFly 14 on Debian 9

That’s it. If you followed all of the instructions properly you can now access your WildFly application using your domain name.

install wildfly on debian


install wildfly on debian 9Of course, you do not need to install WildFly 14 on your Debian 9 VPS yourself if you use our Premium Linux Server Management Services, in which case you can simply ask our expert admins to install it for you. They are available 24/7 and will cater to any requests or questions that you may have.

PS. If you liked this post, feel free to share it with your friends on social networks by using the share shortcuts, or simply leave a comment below. Thanks.

The post How to Install WildFly 14 on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-wildfly-14-on-debian-9/feed/ 2
How to Install XWiki on Debian 9 https://linuxhostsupport.com/blog/how-to-install-xwiki-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-xwiki-on-debian-9/#comments Wed, 03 Oct 2018 09:19:44 +0000 https://linuxhostsupport.com/blog/?p=690 XWiki is a free and open source, Java-based advanced wiki software platform. It runs on servlet containers like JBoss, Tomcat, Jetty etc. It also uses a database such as MySQL or PostgreSQL to store its information. There are several methods of installing XWiki. In this tutorial, we are going to show you how to install […]

The post How to Install XWiki on Debian 9 appeared first on LinuxHostSupport.

]]>
XWiki is a free and open source, Java-based advanced wiki software platform. It runs on servlet containers like JBoss, Tomcat, Jetty etc. It also uses a database such as MySQL or PostgreSQL to store its information. There are several methods of installing XWiki. In this tutorial, we are going to show you how to install XWiki using Debian (.DEB) packages, which is the recommended installation method for a production XWiki setup because all components needed by XWiki for a production instance will be automatically installed on your server. We will use a Debian 9 VPS but you should be able to install XWiki following this tutorial on all Debian based Linux distributions. By following this tutorial, you should have XWiki installed and running in no more than 10 minutes.

1. Connect to your server

To connect to your server via SSH as user root, use the following command:

ssh root@IP_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

apt-get update
apt-get upgrade

2. Add the XWiki repository

Before we begin the installation, you will need to add the official XWiki repository. You can do this by executing the following commands:

wget -q "https://maven.xwiki.org/public.gpg" -O- | sudo apt-key add -
sudo wget "https://maven.xwiki.org/stable/xwiki-stable.list" -P /etc/apt/sources.list.d/

Next, update the list of available packages with:

apt-get update

3. XWiki Installation

To list the available packages offered by this repository, run the following command:

apt-cache search xwiki

You will get the following output on your screen:

xwiki-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-mysql-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-pgsql-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat-mysql - XWiki enterprise Tomcat/MySQL based package
xwiki-enterprise-tomcat-pgsql - XWiki enterprise Tomcat/PostgreSQL
xwiki-enterprise-tomcat5-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat5-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat6-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat6-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat7-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat7-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat7-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat8-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat8-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-enterprise-tomcat8-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-mysql-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-pgsql-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-solr-data - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat7-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat7-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat7-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat8-common - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat8-mysql - XWiki is a free wiki software platform written in Java with a design emphasis
xwiki-tomcat8-pgsql - XWiki is a free wiki software platform written in Java with a design emphasis

You can choose which package you would like to install depending on your needs. In this tutorial, we will install XWiki with Tomcat 8 and MySQL as a database server.

To install this package, you need to run the following command:

apt-get install xwiki-tomcat8-mysql

This will install XWiki, Tomcat 8, MySQL and all the required dependencies on your server. During the installation, you will also be prompted to enter a password for the MySQL ‘xwiki’ user. Once the installation is completed the Tomcat server will be automatically started.

4. Access XWiki

XWiki runs on port 8080. To access your XWiki installation you will need to type the following URL in your web browser: http://your-ip-address:8080/xwiki

You will be asked to create a new admin user for your XWiki and select a flavor. After the browser installation is completed, you can log in as your admin user and access your XWiki admin page:

Installing XWiki on Debian 9

Congratulations! XWiki has been successfully installed on your Debian 9 Server. For more information, make sure you to check the XWiki official documentation.


If you are using one of our premium server management services, you can simply ask our system admins to install XWiki on Debian 9 for you. They are available 24/7 and will take care of your request immediately.  If you liked this post on how to install XWiki on Debian 9, please share it with your friends on social media networks. If you have any question regarding XWiki and its installation on Debian 9, please write a comment below and we will reply asap.

Install XWiki on Debian 9

The post How to Install XWiki on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-xwiki-on-debian-9/feed/ 1
How to Install PHP 7.2 on Debian 9 https://linuxhostsupport.com/blog/how-to-install-php-7-2-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-php-7-2-on-debian-9/#comments Wed, 19 Sep 2018 07:58:12 +0000 https://linuxhostsupport.com/blog/?p=670 In this tutorial, we will show you how to install PHP 7.2 on Debian 9.  PHP 7.2 has been officially released as of November 30th, 2017, and the release has new features and numerous improvements such as: Convert numeric keys in object/array casts Counting of non-countable objects Object typehint HashContext as Object Argon2 in the […]

The post How to Install PHP 7.2 on Debian 9 appeared first on LinuxHostSupport.

]]>
In this tutorial, we will show you how to install PHP 7.2 on Debian 9.  PHP 7.2 has been officially released as of November 30th, 2017, and the release has new features and numerous improvements such as:

  • Convert numeric keys in object/array casts
  • Counting of non-countable objects
  • Object typehint
  • HashContext as Object
  • Argon2 in the password hash
  • Improve TLS constants to sane values
  • Mcrypt extension removed
  • New sodium extension

As you can see above, PHP is no longer using Bcrypt algorithm as a password hash, it is now using Argon2, it is a modern algorithm for securely hashing passwords. This is the most significant changes, it makes PHP more secure. Argon2 beat 23 other algorithms to win the Password Hashing Competition in 2015 and PHP 7.2 introduces as a more secure substitute for the Bcrypt algorithm. However, Bcrypt is still considered a strong hash, especially if compared to its predecessors, md5 and sha1. Bcrypt is still an acceptable hash for passwords. There’s no need to switch if you don’t want to.

The other major change in PHP 7.2 was the removal of the old Mcrypt cryptographic library (hasn’t been updated since 2007)  from the PHP core and the addition of Libsodium, a more modern alternative.

Requirements

– Debian 9 VPS
– SSH access with root privileges to your Debian 9 server

Installing PHP 7.2 on a Debian 9 VPS is a fairly easy task, just follow the steps below and you should have it done in a few minutes.

Step 1. Login to your server

First, let’s log in to your server via SSH:

ssh root@IP_Address -p Port_number

Then, check your existing PHP version, the default PHP version in Debian 9 is PHP 7.0

php -v

configure php 7.2 on debian 9

Remember, before you do anything else, always issue apt update to ensure that your Debian system is using the latest available packages.

apt update && apt upgrade

Step 2: Enable PPA

Let’s invoke the following commands to install the required packages prior to issuing commands to install PHP 7.2. Then, import the packages signing key and configure PPA for the PHP packages on your Debian 9 system.

apt install apt-transport-https lsb-release ca-certificates
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" > /etc/apt/sources.list.d/php.list
apt update

Step 3: Install PHP 7.2

Once you enable the PPA you can proceed and install PHP 7.2 using the following command:

apt install php7.2

Step 4: Search and install specific PHP 7.2 modules

This will also install the required dependencies too. However, if you want to install a specific PHP7.2 module, you can search if it is available using the following command:

apt search php7.2

Step 5: Install most commonly used modules

To install PHP7.2 including some of the most commonly used modules you can use the following command:

apt install php7.2 php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-zip php7.2-fpm php7.2-mbstring

Step 6: Check the installation

php -v

instaalling php 7.2 on debian 9

Now, PHP 7.2 has been installed on your Debian 9 system, and if we want to change the default PHP version to PHP 7.2 that is used on your web server, we need to disable the old PHP and enable the newly installed one.

Disable php 7.0

a2dismod php7.0
systemctl restart apache2

Enable php 7.2

a2enmod php7.2
systemctl restart apache2

Let’s create a phpinfo file

nano /var/www/html/phpinfo.php

Append the following lines to the file, then save and exit nano

<?php
phpinfo();
?>

Now, open http://your_ip/phpinfo.php on your preferred web browser and you will see that apache is now using PHP 7.2

php 7.2 on debian 9 installation

 

 

How to Install PHP 7.2 on Debian 9Please note that you can issue the commands above with apt or apt-get, it’s only a matter of choice. For example, you can either issue “apt update” or “apt-get update”, “apt search” or “apt-cache search”. However, apt is the command that is being recommended by Debian, the mother of Linux distributions like Ubuntu, ElementaryOS, Linux Mint, etc. It provides the necessary option to manage the packages. Also, it is easier to use with its fewer but easy to remember options as well.


Of course, you don’t have to Install PHP 7.2 on Debian 9 yourself. If you use one of our Debian VPS Hosting services in which case, our technical support team will help you. They are available 24×7, simply submit a support ticket and they will take care of your request immediately.

PS. If you liked this post, on how to Install PHP 7.2 on Debian 9, please share it with your friends on the social networks using the buttons below or simply leave a comment. Thanks.

The post How to Install PHP 7.2 on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-php-7-2-on-debian-9/feed/ 10
How to install OwnCloud 10 on Debian 9 https://linuxhostsupport.com/blog/how-to-install-owncloud-10-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-owncloud-10-on-debian-9/#comments Fri, 27 Apr 2018 07:19:54 +0000 https://linuxhostsupport.com/blog/?p=530 ownCloud is a flexible, self-hosted open source PHP web application used for data synchronization and file sharing. ownCloud allows you to easily manage your files, calendars, contacts, to-do lists, and more, making it a great alternative to the popular Google Drive, Box, Dropbox, iCloud and other cloud platforms. Installing ownCloud on Debian, is fairly easy […]

The post How to install OwnCloud 10 on Debian 9 appeared first on LinuxHostSupport.

]]>
ownCloud is a flexible, self-hosted open source PHP web application used for data synchronization and file sharing. ownCloud allows you to easily manage your files, calendars, contacts, to-do lists, and more, making it a great alternative to the popular Google Drive, Box, Dropbox, iCloud and other cloud platforms. Installing ownCloud on Debian, is fairly easy task and should not take more than 15 minutes. This guide should work on other Debian based systems as well but was tested and written for Debian 9 VPS. Let’s get started with installing ownCloud on your Debian 9 server.

1. Install MySQL Server

ownCloud can use MySQL/MariaDB, PostgreSQL, or SQLite as a backend data storage. In this guide we will use MariaDB as database engine.  To install the MariaDB server  run the following command:

sudo apt install mariadb-server

When the installation is complete, run the following commands to start and enable the MariaDB service :

sudo systemctl start mariadb
sudo systemctl enable mariadb

To secure your installation and to setup the root password issue:

sudo mysql_secure_installation

2. Create MySQL Database and Usser

To create a database and mysql user for our ownCloud installation run the following commands:

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE owncloud CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'owncloud_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install Redis

Redis is an in-memory database which will be used by the ownCLoud installation as memory cache. To install the latest Redis version from the default Debian repositories run the following command:

sudo apt install redis-server

3. Install Apache and PHP

Installing Apache, PHP and PHP modules is pretty straightforward process, just issue the following command:

sudo apt install apache2 mariadb-server libapache2-mod-php7.0 \
    openssl php-imagick php7.0-common php7.0-curl php7.0-gd \
    php7.0-imap php7.0-intl php7.0-json php7.0-ldap php7.0-mbstring \
    php7.0-mcrypt php7.0-mysql php7.0-pgsql php-smbclient php-ssh2 \
    php7.0-sqlite3 php7.0-xml php7.0-zip php-redis php-apcu

When the installation is complete, run the following commands to start and enable the Apache service :

sudo systemctl start apache2
sudo systemctl enable apache2

4. Install ownCloud

The ownCLoud 10 package is not available in default Debian 9 repositories so we will install the package from the official ownCLoud repositories. First add the ownCloud GPG key to the apt sources keyring:

wget -qO- https://download.owncloud.org/download/repositories/stable/Debian_9.0/Release.key | sudo apt-key add -

once the key is added run the following command to enable the ownCLoud repository:

echo 'deb https://download.owncloud.org/download/repositories/stable/Debian_9.0/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list

Before installing the ownCLoud package we need to enable HTTPS transport for the debian apt tool by installing the following package:

sudo apt install apt-transport-https

Update the apt cache list and install the ownCLoud package with the following command:

sudo apt update 
sudo apt install owncloud-files

The command above will install the ownCLoud files in the /var/www/owncloud directory.

5. Configure Apache

To configure the Apache web server to serve the ownCLoud directory create a new configuration file with the following content:

sudo nano /etc/apache2/sites-available/owncloud.conf
Alias /owncloud "/var/www/owncloud/"

<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off
</IfModule>

SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud

</Directory>

Enable the Apache ownCloud configuration:

sudo a2ensite owncloud

and restart the Apache web server:

 sudo systemctl restart apache2

Finally set the correct permissions, so the ownCLoud can upload files:

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

6. Finish the ownCLoud installation

In the last step of this guide we need to access to ownCLoud Web Interface and finish the installation.

To finish the installation open your browser and navigate to http://your_server_ip_address/owncloud/.

How to install OwnCloud 10 on Debian 9

To create your first admin user enter the Username and Password under the “Create an admin account” label, next click on the “Storage & Database” link which will give you an option to select your database backed. Leave the default “Data Folder” value “/var/www/owncloud/data” and under the “Configure the database” label and select “MySQL/MariaDB”. In the database fields enter the database user, the database user password and the database name you previously created. Finally clock on the blue “Finish setup” button and the ownCLoud installer will populate the database and redirect you to the ownCloud login screen.


That’s it. You have successfully installed ownCloud 10 server on your Debian 9 VPS. For more information about how to manage your ownCloud installation, please refer to the official ownCloud User Manual.


Of course you don’t have to Install ownCloud on your Debian 9 server, if you use one of our Linux Support Services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on How To Install ownCloud 10 on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

The post How to install OwnCloud 10 on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-owncloud-10-on-debian-9/feed/ 17
How to Speed Up Drupal Using Varnish on Debian 9 https://linuxhostsupport.com/blog/how-to-speed-up-drupal-using-varnish-on-debian-9/ https://linuxhostsupport.com/blog/how-to-speed-up-drupal-using-varnish-on-debian-9/#respond Wed, 14 Mar 2018 07:59:44 +0000 https://linuxhostsupport.com/blog/?p=486 We’ll show you how to speed up Drupal using Varnish on a Debian 9 VPS. Drupal is a popular open source web content management software written in PHP. Drupal is compatible with Varnish 3 and Varnish 4. It is a cross-platform application and supports all popular operating systems, but this tutorial was written for Debian […]

The post How to Speed Up Drupal Using Varnish on Debian 9 appeared first on LinuxHostSupport.

]]>
We’ll show you how to speed up Drupal using Varnish on a Debian 9 VPS. Drupal is a popular open source web content management software written in PHP. Drupal is compatible with Varnish 3 and Varnish 4. It is a cross-platform application and supports all popular operating systems, but this tutorial was written for Debian 9 OS. At the time of writing this tutorial, the latest stable version of Drupal is 8.4.4, and it requires:

  • PHP 5.5.9 or higher (preferably PHP 7.0), with GD library, JSON, cURL, mysqli , Mbstring, DOM, OpenSSL and XML PHP extensions enabled. PHP 7.2 is not supported on the current release.
  • MySQL – 5.5.3 (MariaDB 5.5.20, Percona 5.5.8) or higher with an InnoDB-compatible primary storage engine, PostgreSQL – 9.1.2 or higher, or QLite – 3.6.8 or higher
  • Apache web server 2.2 or higher compiled with mod_rewrite module and AllowOverride set to ‘All’ (please note, the default setting for AllowOverride in Apache 2.3.9 and higher is ‘None’).

This install guide assumes that Apache and MySQL/MariaDB are already installed and configured on your virtual server.
Let’s start with the installation procedure.

1. Update the System Packages

Make sure your server Debian 9 OS packages are fully up-to-date:

apt-get update 
apt-get upgrade

2. Install the Required Packages

Install the required PHP packages for Drupal 8:

apt-get install php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-xml

3. Enable Apache Rewrite Module

Enable Apache rewrite module if it is not already done so:

a2enmod rewrite

4. Restart Apache

Restart the Apache service for the changes to take effect:

service apache2 restart

5. Download and Extract Drupal 8 Files

Download Drupal 8 and install if from source, or install Drupal 8 using Composer.

5.1 Download Drupal 8 from source

Download the latest version of Drupal available at https://www.drupal.org/download in the /opt/ directory on the server:

cd /opt/
mkdir -p /var/www/html/yourdomain.com/
wget -O drupal8.tar.gz https://ftp.drupal.org/files/projects/drupal-8.4.4.tar.gz
tar -xvzf drupal*
mv drupal-*/* /var/www/html/yourdomain.com/

5.2 Download and Install Drupal 8 using Composer – a PHP dependency manager

If you downloaded and extracted Drupal from source, you can skip this step and go to step 6.
Install Composer:

apt-get install composer
mkdir -p /var/www/html/yourdomain.com/
cd /var/www/html/yourdomain.com/

To install the Drupal 8 website on a development server, run:

composer create-project drupal-composer/drupal-project:8.x-dev /var/www/html/yourdomain.com/ --stability dev --no-interaction

Optionally, install Twig C extension:

composer require twig/twig:~1.0

To install the Drupal 8 website on a production server, you also need to run:

composer install --no-dev

This will run the composer install process again remove everyhing from the “require-dev” section from the composer.lock file.

6. Set Proper Ownership of Drupal Files

All files have to be readable by the web server, so set a proper ownership:

chown www-data:www-data -R /var/www/html/yourdomain.com/

7. Create MySQL Database and User

Create a new MySQL database and user:

mysql -u root -p
mysql> SET GLOBAL sql_mode='';
mysql> CREATE DATABASE drupaldb;
mysql> CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'y0uR-pa5sW0rd';
mysql> GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

Do not forget to replace ‘y0uR-pa5sW0rd’ with a strong password.

8. Install and Configure Varnish

apt-get install varnish

Configure Varnish to listen on port 80. Edit the ‘/etc/default/varnish’ Varnish configuration file:

nano etc/default/varnish

Add these lines at the end:

DAEMON _OPTS="-a :80\
  -T localhost:6082
  -f /etc/varnish/default.vcl
  -s malloc,512m"
  -S /etc/varnish/secret

Create a new varnish startup script for systemd:

nano /etc/systemd/system/varnish.service
[Unit]
Description=Varnish HTTP accelerator
Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd

[Service]
Type=simple
LimitNOFILE=131072
LimitMEMLOCK=82000
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,512m
ProtectSystem=full
ProtectHome=true
PrivateTmp=true
PrivateDevices=true

[Install]
WantedBy=multi-user.target

Run the following command to reload systemd manager configuration:

systemctl daemon-reload

Back up default.vcl:

mv /etc/varnish/default.vcl /etc/varnish/default.vcl.bak

Create a new default.vcl file (do not forget to change yourdomain.com with the actual domain name):

nano /etc/varnish/default.vcl

Add these lines

backend default {

.host = “yourdomain.com“;

.port = “8080”;

}

# Access control list for PURGE requests.
# Here you need to put the IP address of your web server
acl purge {
“127.0.0.1”;
}

# Respond to incoming requests.
sub vcl_recv {
# Add an X-Forwarded-For header with the client IP address.
if (req.restarts == 0) {
if (req.http.X-Forwarded-For) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + “, ” + client.ip;
}
else {
set req.http.X-Forwarded-For = client.ip;
}
}

# Only allow PURGE requests from IP addresses in the ‘purge’ ACL.
if (req.method == “PURGE”) {
if (!client.ip ~ purge) {
return (synth(405, “Not allowed.”));
}
return (hash);
}

# Only allow BAN requests from IP addresses in the ‘purge’ ACL.
if (req.method == “BAN”) {
# Same ACL check as above:
if (!client.ip ~ purge) {
return (synth(403, “Not allowed.”));
}

# Logic for the ban, using the Cache-Tags header. For more info
# see https://github.com/geerlingguy/drupal-vm/issues/397.
if (req.http.Cache-Tags) {
ban(“obj.http.Cache-Tags ~ ” + req.http.Cache-Tags);
}
else {
return (synth(403, “Cache-Tags header missing.”));
}

# Throw a synthetic page so the request won’t go to the backend.
return (synth(200, “Ban added.”));
}

# Only cache GET and HEAD requests (pass through POST requests).
if (req.method != “GET” && req.method != “HEAD”) {
return (pass);
}

# Pass through any administrative or AJAX-related paths.
if (req.url ~ “^/status\.php$” ||
req.url ~ “^/update\.php$” ||
req.url ~ “^/admin$” ||
req.url ~ “^/admin/.*$” ||
req.url ~ “^/flag/.*$” ||
req.url ~ “^.*/ajax/.*$” ||
req.url ~ “^.*/ahah/.*$”) {
return (pass);
}

# Removing cookies for static content so Varnish caches these files.
if (req.url ~ “(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$”) {
unset req.http.Cookie;
}

# Remove all cookies that Drupal doesn’t need to know about. We explicitly
# list the ones that Drupal does need, the SESS and NO_CACHE. If, after
# running this code we find that either of these two cookies remains, we
# will pass as the page cannot be cached.
if (req.http.Cookie) {
# 1. Append a semi-colon to the front of the cookie string.
# 2. Remove all spaces that appear after semi-colons.
# 3. Match the cookies we want to keep, adding the space we removed
# previously back. (\1) is first matching group in the regsuball.
# 4. Remove all other cookies, identifying them by the fact that they have
# no space after the preceding semi-colon.
# 5. Remove all spaces and semi-colons from the beginning and end of the
# cookie string.
set req.http.Cookie = “;” + req.http.Cookie;
set req.http.Cookie = regsuball(req.http.Cookie, “; +”, “;”);
set req.http.Cookie = regsuball(req.http.Cookie, “;(SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE)=”, “; \1=”);
set req.http.Cookie = regsuball(req.http.Cookie, “;[^ ][^;]*”, “”);
set req.http.Cookie = regsuball(req.http.Cookie, “^[; ]+|[; ]+$”, “”);

if (req.http.Cookie == “”) {
# If there are no remaining cookies, remove the cookie header. If there
# aren’t any cookie headers, Varnish’s default behavior will be to cache
# the page.
unset req.http.Cookie;
}
else {
# If there is any cookies left (a session or NO_CACHE cookie), do not
# cache the page. Pass it on to Apache directly.
return (pass);
}
}
}

# Set a header to track a cache HITs and MISSes.
sub vcl_deliver {
# Remove ban-lurker friendly custom headers when delivering to client.
unset resp.http.X-Url;
unset resp.http.X-Host;
# Comment these for easier Drupal cache tag debugging in development.
unset resp.http.Cache-Tags;
unset resp.http.X-Drupal-Cache-Contexts;

if (obj.hits > 0) {
set resp.http.Cache-Tags = “HIT”;
}
else {
set resp.http.Cache-Tags = “MISS”;
}
}

# Instruct Varnish what to do in the case of certain backend responses (beresp).
sub vcl_backend_response {
# Set ban-lurker friendly custom headers.
set beresp.http.X-Url = bereq.url;
set beresp.http.X-Host = bereq.http.host;

# Cache 404s, 301s, at 500s with a short lifetime to protect the backend.
if (beresp.status == 404 || beresp.status == 301 || beresp.status == 500) {
set beresp.ttl = 10m;
}

# Don’t allow static files to set cookies.
# (?i) denotes case insensitive in PCRE (perl compatible regular expressions).
# This list of extensions appears twice, once here and again in vcl_recv so
# make sure you edit both and keep them equal.
if (bereq.url ~ “(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$”) {
unset beresp.http.set-cookie;
}

# Allow items to remain in cache up to 6 hours past their cache expiration.
set beresp.grace = 6h;
}

9. Change Apache Listening ports

nano /etc/apache2/ports.conf
Change:
Listen 80
to
Listen 8080

Edit the main Apache configuration file (/etc/apache2/apache2.conf), search for ” and change ‘AllowOverride None’ to ‘AllowOverride All’ so it looks like:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Also, change the port from 80 to 8080 in all virtual hosts located in /etc/apache2/sites-available directory.

10. Create a New Virtual Host in Apache

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘yourdomain.conf’ on your virtual server:

touch /etc/apache2/sites-available/yourdomain.conf
ln -s /etc/apache2/sites-available/yourdomain.conf /etc/apache2/sites-enabled/yourdomain.conf
nano /etc/apache2/sites-available/yourdomain.conf

Then, add the following lines:

<VirtualHost *:8080>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/yourdomain.com>
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/yourdomain.com-error_log
CustomLog /var/log/apache2/yourdomain.com-access_log common
</VirtualHost>

If you downloaded Drupal 8 using Composer, replace ‘/var/www/html/yourdomain.com’ with ‘/var/www/html/yourdomain.com/web’ in the ‘DocumentRoot’ and ‘Directory’ virtual host directives.

11. Restart Apache and Varnish

Restart Apache and Varnish services for the changes to take effect:

service apache2 restart
service varnish restart

12. Install Drupal 8

Open http://yourdomain.com in a web browser , choose install language, click on the ‘Save and continue’ button, select an installation profile (standard), enter the database name, username and password and start the installation. Once installed, you will automatically be redirected to the Drupal 8 administration back-end.

13. Configure Caching

Go to the Drupal 8 administration back-end, click Configuration >> Performance >> set the page cache maximum age and click on the ‘Save configuration’ button:

How to speed up Drupal using Varnish on Debian 9

14. Install Purge and Varnish Purger Modules in Drupal 8

Install the Purge module from the Drupal 8 administration back-end by clicking on Extend >> Install new module , then enter: https://ftp.drupal.org/files/projects/purge-8.x-3.0-beta8.tar.gz in the ‘Install from a URL’ field and click on the ‘Install’ button.

speed up Drupal using Varnish on Debian 9

Then, install the Varnish Purger module by clicking on Extend >> Install new module >> enter: https://ftp.drupal.org/files/projects/purge-8.x-3.0-beta8.tar.gz in the ‘Install from a URL’ field and click on the ‘Install’ button.

Open http://yourdomain.com/admin/modules and select Purge, Purge Drush, Purge Tokens, Purge UI, Cron processor, Late runtime processor, Core tags queuer, Varnish Focal Point Purger, Varnish Image Purge, Varnish Purger and Varnish Purger Tags, then click on the ‘Install’ button.

15. Configure Varnish Purger

Open http://yourdomain.com/admin/config/development/performance/purge , click Add purger >> Varnish Purger and click on the ‘Add’ button. Click on the newly created button, select configure and add ‘Varnish Purger’ in the name field:

how to speed up Drupal using Varnish on Debian 9

Configure the Purger’s headers by clicking on Headers >> and enter ‘Cache-Tags’  in the header field with the value [invalidation:expression] and click on the ‘Save configuration’ button.

16. Test if Varnish Caching works

In order to test if Varnish caching is woking properly, run the following command on your server:

curl -s --head http://yourdomain.com/about | grep -i cache
Cache-Tags: MISS

Then, run it once again:

curl -s --head http://yourdomain.com/about | grep -i cache

You should receive an output like this:

Cache-Tags: HIT

You can also use varnishadm, varnishstat and varnishlog command line utilities to check if everything works OK.

That is it. Drupal 8 has been configured to use Varnish.


Of course you don’t have to speed up Drupal using Varnish on Debian 9, if you use one of our Linux Server Support Services, in which case you can simply ask our expert Linux admins to do this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to speed up Drupal using Varnish on Debian, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

The post How to Speed Up Drupal Using Varnish on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-speed-up-drupal-using-varnish-on-debian-9/feed/ 0
How to Install and Configure Observium on Debian 9 https://linuxhostsupport.com/blog/how-to-install-and-configure-observium-on-debian-9/ https://linuxhostsupport.com/blog/how-to-install-and-configure-observium-on-debian-9/#comments Wed, 07 Feb 2018 08:31:55 +0000 https://linuxhostsupport.com/blog/?p=434 We’ll show you how to install Observium on a Debian 9 server. Observium is a network monitoring software written in PHP. It is a cross-platform application and supports all popular operating systems, but this tutorial was written for Debian 9 OS. At the time of writing this tutorial, the latest stable version of Observium is 17.9, and […]

The post How to Install and Configure Observium on Debian 9 appeared first on LinuxHostSupport.

]]>
We’ll show you how to install Observium on a Debian 9 server. Observium is a network monitoring software written in PHP. It is a cross-platform application and supports all popular operating systems, but this tutorial was written for Debian 9 OS. At the time of writing this tutorial, the latest stable version of Observium is 17.9, and it requires:

  • PHP 5.6 or higher (preferably PHP 7.0), with mbstring, pear, mcrypt, JSON, mysqli and GD PHP extensions enabled. PHP 7.1 is not supported on the current community edition release.
  • MySQL 5, MariaDB 5 or later
  • Apache web server 2.2 or higher compiled with mod_rewrite module and AllowOverride set to ‘All’ (please note, the default setting for AllowOverride in Apache 2.3.9 and higher is ‘None’).

This install guide assumes that Apache and MySQL/MariaDB are already installed and configured on your virtual server.

Let’s start with the installation procedure.

1. Update the System Packages

Make sure your server Debian 9 OS packages are fully up-to-date:

apt-get update 
apt-get upgrade

2. Install the Required Packages

Install the required packages for Observium:

apt-get install php7.0-cli php7.0-mysql php7.0-mysqli php7.0-gd php7.0-mcrypt php7.0-json php-pear imagemagick snmp fping python-mysqldb subversion whois mtr-tiny ipmitool graphviz rrdtool

3. Enable Apache Rewrite Module

Enable Apache rewrite module if it is not already done so:

a2enmod rewrite

4. Restart Apache

Restart the Apache service for the changes to take effect:

service apache2 restart

5. Install Observium on Debian 9

Download the latest community version of Observium available at http://www.observium.org in the /opt/ directory on the server:

cd /opt/
wget http://www.observium.org/observium-community-latest.tar.gz
tar zxvf observium-community-latest.tar.gz
mv observium /var/www/html/observium
mkdir -p /var/www/html/observium/rrd
        

6. Set Proper Ownership of Observium Files

All files have to be readable by the web server, so set a proper ownership:

chown www-data:www-data -R /var/www/html/observium

7. Create Database and User

Create a new MySQL database and user:

mysql -u root -p
mysql> SET GLOBAL sql_mode='';
mysql> CREATE DATABASE observiumdb;
mysql> CREATE USER 'observiumuser'@'localhost' IDENTIFIED BY 'y0uR-pa5sW0rd';
mysql> GRANT ALL PRIVILEGES ON observiumdb.* TO 'observiumuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

Do not forget to replace ‘y0uR-pa5sW0rd’ with a strong password.

8. Create a New Virtual Host

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘observium.conf’ on your virtual server:

touch /etc/apache2/sites-available/observium.conf
ln -s /etc/apache2/sites-available/observium.conf /etc/apache2/sites-enabled/observium.conf
vi /etc/apache2/sites-available/observium.conf

Then, add the following lines:

<VirtualHost *:80>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/observium/html
ServerName your-domain.com
ServerAlias www.your-domain.com
 <FilesMatch \.php$>
 SetHandler application/x-httpd-php
 </FilesMatch>
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 </Directory>
<Directory /var/www/html/observium/html>
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
</VirtualHost>

Remove the 000-default.conf file:

rm /etc/apache2/sites-enabled/000-default.conf

9. Restart Apache Web Server

Restart the Apache web server for the changes to take effect:

service apache2 restart

10. Create a config.php File

vi /var/www/html/observium/config.php

Add the following lines:

<?php

$config[‘db_extension’] = ‘mysqli’;
$config[‘db_host’] = ‘localhost’;
$config[‘db_user’] = ‘observiumuser’;
$config[‘db_pass’] = ‘y0uR-pa5sW0rd’;
$config[‘db_name’] = ‘observiumdb’;

$config[‘snmp’][‘community’] = array(“public”);
$config[‘auth_mechanism’] = “mysql”;

Then, run the following commands to insert the default schema:

cd /var/www/html/observium/
php ./discovery.php -u

11. Create a user account

Create a user account, use level of 10 for admin .e.g.:

./adduser.php admin <password> 10

12. Continue Observium Installation in a Web Browser

Open http://your-domain.com in your favorite web browser and log in using the newly created admin account:

Install Observium on Debian 9

Install and Configure Observium on Debian 9

That is it. Observium has been installed on your server.


Of course you don’t have to install Observium on Debian,  if you use one of our Outsourced Hosting Support services, in which case you can simply ask our expert Linux admins to install Observium on a Debian 9 server, for you. They are available 24×7 and will take care of your request immediately.

PS. If you enjoy reading this post on how to Install Observium on a Debian 9 server , feel free to share it on social networks using the shortcuts below, or simply leave a comment.

The post How to Install and Configure Observium on Debian 9 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-and-configure-observium-on-debian-9/feed/ 3