Archive for the ‘ Apache ’ Category

Changing default apache page on Ubuntu


Open your Apache configuration file httpd.conf

on ubuntu it is in /etc/apache2/httpd.conf and open it using

sudo gedit /etc/apache2/httpd.conf

then put your desired filename on directory index—

DirectoryIndex index.html index.htm default.htm index.php index.pl

Changing default apache page on Ubuntu

Open your Apache configuration file httpd.conf

on ubuntu it is in /etc/apache2/httpd.conf and open it using

sudo gedit /etc/apache2/httpd.conf

then put your desired filename on directory index—

DirectoryIndex index.html index.htm default.htm index.php index.pl

Advertisements

Simple steps to setting up virtual host host on Ubuntu Server


Virtual host is a virtual environment over the top of your current web server to simulate a separate hosting environment. Using virtual host you can enable site specific features and keep your development environment totally separate from another one.

For tutorial you need to mod_rewrite enabled.

Step 1: setup hosts file

open /etc/hosts and add a virtual domain with a specific local IP.

Lets assume that our virtual domain name is “ruzdi.com” and It will listen to the ip “127.0.0.2″

so on /etc/hosts file we will add

127.0.0.2 ruzdi.com

now whenever you browse http://ruzdi.com your browser will actually hit http://127.0.0.2

Step2: configure virtual host with apache
Now goto /etc/apache2/sites-available and create a file named “ruzdi.com

sudo touch ruzdi
sudo gedit /etc/apache2/sites-available/ruzdi

write the following contents inside. but please note to create the appropriate directory before linking your virtual host with that, for example we’ve create a folder named “/var/opt/ruzdi” and linked that directory as my document root in the following configuration file.



<VirtualHost 127.0.0.2:80>
        ServerName  ruzdi.com
        ServerAlias  ruzdi.com
        ServerAdmin admin@ruzdi.com
        DocumentRoot /opt/ruzdi
        <Directory /opt/ruzdi/>
                Options FollowSymLinks
                AllowOverride All
        </Directory>

</VirtualHost>

now create a symbolic link of this file to /etc/apache2/sites-enabled directory as “ruzdi.com

sudo ln -s /etc/apache2/sites-available/ruzdi /etc/apache2/sites-enabled/ruzdi

**** here look directory location is /opt/ruzdi so you must create a directory named “ruzdi” on /opt location

Step 3: restart apache

simple, either one of the followings

sudo a2ensite ruzdi

And

sudo /etc/init.d/apache2 restart

now on your browser to http:// ruzdi.com

***This is post is similar Hasin Hyder blog post I just change a little. In my case on the hosts file port was not working so I removed it and I got everything all right.

source :

Apache

Hasin Hyder