Monday, March 13, 2017

Make Apache2 server HTTPS secure

1. Create key and cerificate files.

cd /etc/apache2/
mkdir -p ssl/crt
mkdir -p ssl/key 
cd ssl 
openssl req -newkey  rsa:2048 -nodes -keyout key/vhost2.key    -x509 -days 365 -out crt/vhost2.crt  


2. Configure Virtual host in the file /etc/apache2/sites-available/000-default.conf


...
<VirtualHost *.443>        
        DocumentRoot /var/www/secure
        ServerName vhost1.yourdomain.com
        # DirectoryIndex index.php
        ErrorLog /var/log/apache2/vhost1-error.log
        CustomLog /var/log/apache2/vhost1-access.log combined
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/crt/vhost2.crt
        SSLCertificateKeyFile /etc/apache2/ssl/key/vhost2.key
        <Location />
        SSLRequireSSL On
        SSLVerifyClient optional
        SSLVerifyDepth 1
        SSLOptions +StdEnvVars +StrictRequire
        </Location>
        <Directory "/var/www/vhost1">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                AddHandler cgi-script .py
                AddHandler default-handler .html .htm
                Allow from all
         </Directory>
</VirtualHost>


3. Install modes
    sudo a2enmod rewrite
    sudo a2enmod ssl 


3.  Restart Apache2 

    sudo service apache2 restart 

Thursday, March 2, 2017

Installing new partition for swap space

1. Add new disk in VMWare. In the example it is 3rd disk.
    a. Power off machine
    b. Edit Settings
    c. Add ...   Hard Disk , Next
    d. Create a new virtual disk, Next
    e. Capacity 2GB , Thick provision Lazy Zeroed, Next , Next
    f. Finish
       
2. Create MS-DOS partition table.
    > fsdisk /dev/sdc
    > n (new)
    > p (primary)
    > 1 (first)
    > w (write) 

3. Install and used GUI program gparted
    > sudo apt-get install gparted 


4. Start gparted from Ubuntu GUI.  
   a. Select device GParted / Devices / dev/sdc1 
   b. Device / Create Partition Table , , Apply 
   c. Create partition: Patrition / New /
   d. Create as: Primary Patrition, File system: linux-swap, Label: swap / Add 

   e. Edit /  Apply All Operations 
   f. Partition / Swapon 
   g. GParted / Quit 

5. Make your changes permanent by adding entry to /etc/fstab file: 

mpug@testtool13:/$ vi /etc/fstab

# /etc/fstab: static file system information.
## Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices# that works even if disks are added and removed. See fstab(5).##
/dev/mapper/testtool97--vg-root /               ext4    errors=remount-ro 0       1

# /boot was on 
/dev/sda1 during installationUUID=b36b850c-0a22-4f02-9516-83b80d5a6c1f 
/boot           ext2    defaults        0       2
/dev/mapper/testtool97--vg-swap_1 none            swap    sw              0       0
/dev/sdc1                         none            swap    sw              0       0
/dev/fd0       /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
/dev/testtool97-disk/disk /disk               ext4    errors=remount-ro 0       1

Followers

About Me