Category Archives: virtuozzo

Enabling/Disabling Directory listing in Apache

Enabling/Disabling Directory listing in Apache

Locate your apache configuration file – httpd.conf and edit it using vi editor, normally in the location /etc/httpd/conf/httpd.conf

To turn on automatic directory indexing, find the Options directive that applies to the directory and add the Indexes keyword. For example:

<Directory /path/to/directory>
Options +Indexes

To turn off automatic directory indexing, remove the Indexes keyword from the appropriate Options line. To turn off directory listing for a particular subdirectory, you can use Options -Indexes. For example:

<Directory /path/to/directory>
Options -Indexes

I had a situation where none of the Options combinations worked.  Then only I noticed that the mod_autoindex was not loaded and the module as suh is not compiled with apache. I had to compile and enable the module to get directory listing working. The steps for compilation are given below.

1. Download the apache source tarball from apache download site

2. Untar the tarball and locate the mod_autoindex.c file in the directory `generators`

3.Switch to the directory `generators` and compile the .c file as shown below using apxs

[root@localhost autoindex]# /opt/apache2.0.55/bin/apxs -c mod_autoindex.c
/opt/apache2.0.55/build/libtool –silent –mode=compile gcc -prefer-pic  -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/opt/apache2.0.55/include  -I/opt/apache2.0.55/include   -I/opt/apache2.0.55/include   -c -o mod_autoindex.lo mod_autoindex.c && touch mod_autoindex.slo
/opt/apache2.0.55/build/libtool –silent –mode=link gcc -o  -rpath /opt/apache2.0.55/modules -module -avoid-version    mod_autoindex.lo

4. Once compiled, you can find the file generated in the following location

[root@localhost autoindex]# ls -la .libs/
-rwxr-xr-x 1 root root 90078 Oct  4 18:16 .libs/

5.Copy the .so file to modules directory

[root@localhost autoindex]# cp .libs/ /opt/apache2.0.55/modules/

6. Add the following line to apache configuration file

LoadModule autoindex_module modules/

7. Do a apacheconfigtest and restart apache

[root@localhost autoindex]# /opt/apache2.0.55/bin/apachectl configtest
Syntax OK

[root@localhost autoindex]# /opt/apache2.0.55/bin/apachectl restart

Recheck now if the URL is listing directories!

Reboot command in a VPS

Reboot command in a VPS

Did you ever try restarting your virtuozzo VPS by hitting the ‘reboot’ command inside the VPS? If you’ve done, you might have had troubles in having it back online automatically. ‘reboot’ command works in a different way inside a VPS unlike a dedicated server. when you issue this command, VPS is stopped and started by a different script in the hardware node which is executed  in every minute.

When you hit reboot command inside the VPS, it invokes reboot system call with argument ‘restart’, which has to be handled by BIOS in normal cases. But since its a VPS, the system call is blocked from within since the VPS shouldnt talk directly with bios, which otherwise can result in a reboot of hardware node! So internelly, the reboot command is being handled this way

1. the VPS is simply stopped when reboot command is issues from within.
2. VPS is started again using a script /etc/sysconfig/vz-scripts/vereboot which is invoked automatically using a cron job specified in  /etc/cron.d/vereboot in ever 1 or 2 minutes depending on the cron

So its a better Idea to go for VZPP to get your virtuozzo VE rebooted rather than issuing a reboot command