Hide directory tree in Apache server

Take me hours to figure this crap out. Anyways, here’s the short story:

 

Open apache configuration file:

sudo nano /etc/apache2/apache2.conf

 

Scroll down to the <Directory /var/www/>. Add Options -Index and comment Option Indexes FollowSymLinks like so:

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

 

That’s all you have to do to hide the directory list. Happy Programming! DX

Server Setup on Instances

Install Apache

sudo apt-get install apache2-mpm-prefork
sudo a2enmod userdir
sudo a2enmod expires

Restart Apache

sudo /etc/init.d/apache2 restart 
sudo service apache2 restart

Install MySQL

sudo apt-get install mysql-server mysql-client

Create DB user in MySQL

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE db_name;
GRANT ALL ON db_name.* TO 'username'@'localhost';

Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install libapache2-mod-php5

 

Linux Commands

Remove directory and all the files/folders in it:
rm -rf <folder_name>

Copy a directory and all its contents:
cp -a /source/. /dest/

Git commands

Stage only modified files and not untracked ones
git add -u

Commit
git commit -m 'your_message'

Clear Install Windows under Dual Boot System

I haven’t been using Windows for too long that I really couldn’t retreive the admin password back to the brain. Since I have a dual boot system (Lubuntu & Win7 Ultimate), I thought I had to wipe everything and redo the whole setup again, but fortunately Linux system can actually be preserved. We only need to redo the Windows setup and reset Linux grub.

Reinstall Windows

  1. Insert Windows Installtion disk
  2. Format the partition that is labelled Primary
  3. Install Windows on the Primary partition

After clean installing Windows, grub is gone from the startup and jump straight into Win7 system. To restore the option for choosing OS, we need to get the grub back.

Recover grub (Lubuntu 14.04)

  1. Insert Linux disk / usb and select the option “Try without installing Lubuntu”
  2. Alt + Shift + T to open terminal
  3. Run sudo fdisk -l to display a list of partitions on the hard drive
  4. Run sudo mount /dev/sdaX /mnt where X is the number labeled with Linux
  5. Run sudo grub-install --root-directory=/mnt /dev/sda to install grub
  6. Run sudo update-grub
  7. Reboot

*Note: if you get an error that say “Can’t find /dev/sdaX in /etc/fstab or /etc/mtab” from Step 4, you should double check to make sure that there are no whitespaces missing from the command.

 

 

 

Check if Linux System is Running on 32- or 64-bit

Type the following command in the terminal (CTRL + ALT + T):

uname –m

 

If the value returns either i386 or i686, the system is 32-bit.

If it returns x86_64, you have a 64-bit system.

If you get other thing else, you most likely type the wrong command or come from the future (128-bit?).

 

😛 ~Bonus~ 😛

  • Difference between i386 and i686 is rather trivial. Basically, i386 (Intel 80386) is an older processor than i686 (P6: 6th gen of intel x86 system and is mostly used in Pentium CPUs).