How To Protect Directory With Password on Nginx

Protect Directory With Password on Nginx

Unlike Apache, Nginx does not have any .htaccess file. Password protection is achieved by using the Nginx HttpAuthBasic module directives in the configuration file. For future reference, I will show you a steps to protect directory with password on nginx. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS.

Protect Directory With Password on Nginx

Step 1. First add the following to your Nginx configuration file:

location / {
  auth_basic            "Restricted";
  auth_basic_user_file  /etc/nginx/htpasswd;
}

Step 2. Create the htpasswd file, notice that the file is /etc/nginx/htpasswd. This means you need to use htpasswd to create that file:

htpasswd -c /etc/nginx/htpasswd yourusername
New password: 
Re-type new password: 
Adding password for user yourusername

Step 3. This will create the password file. Next restart nginx’s configuration:

 service nginx restart

Now when you visit your directory or domain, you will be asked to enter a username and password that you chose beforehand. This is definitely not the most secure way of restricting domain access.

Congratulation’s! You have successfully protect directory on Nginx. Thanks for using this tutorial for protect directory with password on Nginx system. For additional help or useful information, we recommend you to check the official Nginx web site.

You Might Also Like: How To Install Let’s Encrypt SSL With Nginx on Ubuntu 16.04 LTS

How To Install Apache SVN on CentOS 7

Install Apache SVN on CentOS 7

Apache Subversion which is commonly referred to in its abbreviated form as SVN, (named after the command name SVN) is a popular software versioning and revision control system which is distributed as a free software under the Apache License. Mainly used by developers to maintain present and historic file versions like documentation, source code, and web pages, it primarily aims to be a compatible successor to the extensively used CVS (Concurrent Versions System).

SVN supports several protocols for network access: SVN, SVN+SSH, HTTP, HTTPS. If you are behind a firewall, HTTP-based Subversion is advantageous since SVN traffic will go through the firewall without any additional firewall rule setting. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS.

In this tutorial we will show you how to install and configuration of Apache Subversion on your CentOS 7 server.

Install Apache SVN on CentOS 7

Step 1. First, you need to install subversion and mod_dav_svn (this stands for the Apache httpd module for subversion server) using the following command:

 yum install httpd subversion mod_dav_svn

Step 2. Configure Subversion with Apache.

Once installing the package, you must open the subversion httpd config file.

 nano /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Subversion User Authentication "
   AuthUserFile /etc/svn-users
   Require valid-user
</Location>

Step 3. Create SVN users.

Following commands will add two users for svn. It will prompt for users password to be assigned.

htpasswd -cm /etc/svn-users wpcademy
htpasswd -m /etc/svn-users p@sswd

Step 4. Create and configure SVN repository

cd /var/www/svn
svnadmin create testrepo
chown -R apache.apache testrepo

If you still have issues with SELinux Security please apply this:

chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

Step 5. Restart your web server.

 systemctl restart httpd.service

Step 6. Finally, You can visit the url http://your-ip-address/svn/testrepo to check out the content, you will be asked to enter the user name and password.

Step 7. Create basic repository structure with the below commands.

mkdir -p /tmp/svn/{trunk,branches,tags}
svn import -m 'Initializing basic repository structure' /tmp/svn/ http://localhost/svn/testrepo/

Congratulation’s! You have successfully installed Apache Subversion. Thanks for using this tutorial for installing Apache Subversion on CentOS 7 system. For additional help or useful information, we recommend you to check the official Apache SVN web site.

You Might Also Like: How To Install Apache SVN on Ubuntu 14.04

How To Install Rar/Unrar Packages on Ubuntu

Install Rar/Unrar Packages on Ubuntu

RAR is most popular tool for creating and extracting compressed archive (.rar) files, but unfortunately rar tool doesn’t pre-installed under Linux systems, we need to install it using third-party tools to open, extract, uncompress or unrar a archive files.

By default the rar and the unrar packages do not come pre-installed in the Ubuntu operating system. This means you cannot create a rar archive or unrar an existing one! It is pretty simple to install them. You need to enable multiverse repositories to install rar. There’s also a separate package called unrar. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS.

In this tutorial we will learn how to install and configuration of Rar/Unrar on your Ubuntu.

Install Rar/Unrar Packages on Ubuntu

Step 1. First, enable multiverse repositories.

 sudo software-properties-gtk

Step 2. Installing rar and unrar packages.

Run the following command in terminal and type the password for the user, when prompted.

sudo apt-get update
sudo apt-get install rar unrar

Commands for Rar/Unrar archive

Following are the some useful and helpful rar/unrar archive commands:

# unrar x (file_name).rar           extract with full path
# unrar e -kb (file_name).rar       (Keep broken)
# unrar l (file_name).rar           list files inside
# unrar e (file_name).rar           dump files excluding folders
# rar a (file_name).rar (file_name) create a archive Rar file
# rar r (file_name).rar             recover or fix a archive file or files
# rar a -p (file_name).rar          create a archive Rar file with password

Congratulation’s! You have successfully installed rar/unrar.

You Might Also Like: Click here to learn How To Install Rar/Unrar Packages on CentOS

How To Install Lighttpd on Ubuntu 14.10

Install Lighttpd on Ubuntu

Lighttpd is a fast and secure web-server which has been optimized for high-performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. Here’s a brief tutorial will explain you the installation of Lighttpd web server on Ubuntu.

In this tutorial we will show you how to install and configuration of Lighttpd on your Ubuntu 14.04 server.

Install Lighttpd on Ubuntu 14.10

Step 1. Installing Lighttpd.

Lighttpd is available to install from the official Ubuntu repositories, So if you want to install Lighttpd, you only have to run this command.

 sudo apt-get install lighttpd

Step 2. Installing PHP5 and modules.

Ubuntu provides a FastCGI-enabled PHP5 package. We can install by issuing the following command.

 sudo apt-get install php5-cgi php5-mysql

Enable fast-cgi support.

sudo lighttpd-enable-mod fastcgi
sudo lighttpd-enable-mod fastcgi-php

Step 3. Start Lighttpd server.

 /etc/init.d/lighttpd force-reload

Step 4. Testing Lighttpd webserver.

To make sure everything installed correctly we will now test Lighttpd to ensure it is working properly. Open up any web browser and then enter the following into the web address:

 http://localhost/ or http://your.ip.addr.ess

lighttpd-ubuntu

Note: Lighttpd’s default document root is /var/www on Ubuntu, and the configuration file is /etc/lighttpd/lighttpd.conf. Additional configurations are stored in files in the /etc/lighttpd/conf-available.

Congratulation’s! You have successfully installed Lighttpd. Thanks for using this tutorial for installing Lighttpd web server on ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Lighttpd web site.

You Might Also Like: How To Install Lighttpd on CentOS

How To Install Kloxo MR on CentOS 6

Install Kloxo MR on CentOS 6

Kloxo-MR is a fork of original LXCenter’s kloxo project and its developed by Mustafa Ramadan, hence the “MR”. Kloxo MR not only fixes the bugs of Kloxo but it has many additional features like the ability to switch to Nginx server. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. Follow guide how to install Kloxo MR on CentOS 6.
In this tutorial we will show you how to install and configuration of Kloxo MR on your CentOS 6 server.

Install Kloxo-MR on CentOS 6

Step 1. Update all the packages installed of the Operating System.

 yum update -y

Step 2. Install the needed packages.

yum install yum-utils yum-priorities vim-minimal subversion curl zip unzip -y
yum install telnet -y

Step 3. Make sure SELinux is disabled.

We have to disable SELinux, cause it not correctly disabled, the Kloxo installation useless and may required to reload OS to re-install it properly.

setenforce 0
echo ‘SELINUX=disabled’ > /etc/selinux/config

Step 4. Download Kloxo-MR repo.

wget https://github.com/mustafaramadhan/kloxo/raw/release/kloxo-mr.repo –no-check-certificate
cd /

Step 5. Install Kloxo-MR.

 yum install kloxomr-y

Now, run setup.sh before reboot.

 sh /script/upcp

It will ask you whether you want to install it as slave or master. Choose the option 1 (Master) and click enter. That’s it. Reboot the server after installation completes.

Step 6. Once it complete, we can navigate to our kloxo admin panel http://serverip:7777 over SSL or http://serverip:7778 without over SSL. So the traffic such as passwords and data will be sent unencrypted (plain). If we had trouble login to our kloxo admin panel. We should be stop the firewall before and make sure the firewall permit kloxo traffic at 7777 and 7778 port. Default username is admin and password is admin.

Congratulation’s! You have successfully installed Kloxo MR. Thanks for using this tutorial for installing Kloxo MR control panel on CentOS 6 system. For additional help or useful information, we recommend you to check the official Kloxo MR web site.

How To Install Fail2Ban on Ubuntu

Install Fail2Ban on Ubuntu

Fail2Ban is a utility that is used to detect and prevent brute force intrusion. By scanning logs for certain actions, such as repeated failed login attempts, Fail2Ban is able to alter firewall configurations to halt further events. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. Follow guide how to install Fail2Ban on Ubuntu.

In this tutorial we will show you how to install and configuration of Fail2Ban on your Ubuntu server.

Install Fail2Ban on Ubuntu

Step 1. First log-in as root user and enter the following command to install Fail2ban.

 apt-get install fail2ban

Step 2. Once that has finished, go ahead and create your “local” jail (this is where you define your overrides of jail.conf). You can read more about jails here.

 cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Step 3. Setup Fail2ban default configuration.

 nano /etc/fail2ban/jail.local

Now, you will see default section with some basic rules that are followed by fail2ban itself. If you want to add some extra layer of protection to your server, then you can customize the each rule section as per your needs. There are few lines act as basic setup you can edit as necessary to suit your need including: ignoreip, bantime, findtime, and maxretry. You can read what each line means in the explanation available there.

[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8

# "bantime" is the number of seconds that a host is banned.
bantime = 600

# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
maxretry = 3

# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = root@localhost

Step 4. Restarting Fail2Ban service.

 service fail2ban restart

Congratulation’s! You have successfully installed Fail2Ban. Thanks for using this tutorial for installing Fail2Ban on Linux ubuntu system. For additional help or useful information, we recommend you to check the official Fail2Ban web site.

How To Install Gnome GUI on CentOS 7

Install Gnome GUI on CentOS 7

By default, RHEL/CentOS 7 server installed as minimal without any Graphical Desktop support. Installing GNOME Desktop on CentOS is faily straightforward. Most CentOS servers are run on CLI (Command-Line Interface) mode. But in some cases, one may need to have a desktop to install some applications with GUI (Grapich User Interface) mode. In this case, we will use GNOME, the most popular user-friendly desktop for any UNIX based system. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. Follow guide how to install Gnome GUI on CentOS 7.

In this tutorial we will show you how to install and configuration of Gnome on your CentOS 7 server.

Install Gnome GUI on CentOS 7

Step 1. Install Gnome GUI by issuing the following command.

CentOS 7:

 yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

RHEL 7:

 yum groupinstall "Server with GUI"

Step 2. When the installation finishes, run the following command to tell the system to boot Gnome Desktop automatically at system startup.

 ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

Step 3. Reboot the system.

After you reboot the system , the system will enter into the Gnome GUI interface automatically.

centos-7-desktop-installation

Step 4. Installing additional applications.

After logging in to the GNOME Desktop, you can now go to System > Administration > Add/Remove Software to manage application in CentOS. By using this wizard, you can install various applications similar to yum but through a GUI. Applications installed using this method will appear in the Application menu list.

Congratulation’s! You have successfully installed Gnome. Thanks for using this tutorial for installing Gnome GUI on CentOS 7 system. For additional help or useful information, we recommend you to check the official Gnome web site.

You Might Also Like: How To Install GNOME on Ubuntu 14.04