Archive for February 3rd, 2018

Create virtual host on a Debian Stretch server

After a Debian 9 server (Debian GNU/Linux 9 (stretch)) was installed, a web server with virtual host capability was needed.  At the first step, creating a conf file for the virtual host and enabling it and  then restarting the apache2 service were successful. However, the next step was not straightforward.  After files were copied to the root folder of the virtual host, error messages were persistent whenever which pages were visited.

The error message like” You don’t have permission to access <page name> on this server”. It was wired because the same virtual host conf file was fine on Ubuntu servers with old Linux version.

After googling the internet, the problem was nailed down. the new version of Apache2 increases the security of virtual hosts. One more directive is needed to make it work. In the virtual host conf file, need add “Require all granted”. A working version of an virtual host conf file is the following.

<VirtualHost *:80>
ServerName 192.168.0.200

# Indexs + Directory Root.
DirectoryIndex index.html index.php
DocumentRoot {your virtual host root data folder}

<Directory />
  Options FollowSymLinks
  AllowOverride None
</Directory>

<Directory "{your virtual host root data folder}">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  # new directive needed in Apache 2.4.3 and beyond
  Require all granted
</Directory>

# Logfiles
ErrorLog {your virtual host root folder}/logs/error.log
CustomLog {your virtual host root folder}/logs/access.log combined

</VirtualHost>
Share

Tags: , , , ,

Ping external domain failed on Debian Stretch

After a debian stretch server was setup, pinging external domain always failed. That makes installing any packages / software impossible because it cannot access the ftp.debian.org server.

After a lengthy searching on Google, finally the problem was nailed down and solved easily. The cause of the problem is the Debian Network Manager. To solve this problem, please execute the following command line commands in a terminal.


apt-get remove --purge network-manager
nano /etc/resolv.conf

Add the following line to the resolv.conf file.

nameserver 192.168.0.1

You should change the IP address based on your wireless network accordingly.

After the change, reboot your computer to a fresh start. Then execute the following commands.


apt-get update
apt-get install <your package name>

Share

Tags: , ,