Search This Blog

Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Thursday, December 1, 2011

Setting Up Name Based Virtual Hosting In Ubuntu

1. Append the following line to your /etc/apache2/apache2.conf .
     NameVirtualHost 127.0.0.2:80
2 . Create unique files for each of my domains within the /etc/apache2/sites-available/ folder.Create a fie called mysitename.com

<VirtualHost 127.0.0.2:80>
ServerName 
mysitename.com
ServerAlias www.
mysitename.com
ServerAdmin me@ubuntu.com
DocumentRoot /var/www/mysitename/html
</VirtualHost>


3. Enable it by creating a symbolic link from one folder to the next ( etc/apache2/sites-enabled/)

sudo a2ensite mysitename.com ( to diable it anytime sudo a2dissite  mysitename.com)  

harder way to create the symbolic link 

cd /etc/apache2/sites-enabled/
ln -s ../sites-available/
mysitename.com .


4. Editing the /etc/hosts by adding the following line

127.0.0.2:80 mysitename.com 

5. Restart apache sudo /etc/init.d/apache2 restart

****

To enable mod_rewrite in Ubuntu, you just need to write this command in terminal

sudo a2enmod rewrite

Saturday, October 29, 2011

How to create virtual host In XAMPP in windows

1.Create a folder in C:\xampp\htdocs\mysite
2. Edit your hosts file in windows  located in C:\WINDOWS\system32\drivers\etc\ and add following line
127.0.0.1 mysite.localhost
Don’t delete the existing “127.0.0.1 localhost” line
3.Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following lines

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
</VirtualHost>


<VirtualHost *:80>
    ServerName mysite.localhost
    DocumentRoot C:\xampp\htdocs\mysite
    <DirectoryC:\xampp\htdocs\mysite>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
4. Reboot your computer .You should now be able to access each dev domain by way of:
http://mysite.localhost/

Monday, May 2, 2011

Installing Apache, PHP, MySQL on Ubuntu


Install Apache 

Open Terminal (Application -> Accessories -> Terminal) and execute the following command:
sudo apt-get install apache2

check if the Apache is working properly by pointing your browser to http://localhost. If you see the text “It works!”, it means Apache is working.

Issue the following command to resolve following error “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“

sudo  gedit /etc/apache2/conf.d/fqdn

When Gedit opens, type “ServerName localhost” inside the file and click Save

Install PHP



Inside Terminal, execute the following command:
sudo apt-get install php5 libapache2-mod-php5

execute this to restart apache

Execute the following command in Terminal:
    sudo /etc/init.d/apache2 restart

Install MySql

sudo apt-get install mysql-server



Inside Terminal, execute the following command:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Give the root password to complete the installation


Sunday, January 30, 2011

Command To Show the enabled modules in apache

sudo apache2ctl -l

Enable mode rewrite in apache2 ubuntu

This command works fine in ubuntu ,login as the root and type the following command to enable mode_rewrite.

sudo gedit /etc/apache2/sites-available/default


In the following section change AllowOverride None to AllowOverride All.


 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 # Uncomment this directive is you want to see apache2's
 # default start page (in /apache2-default) when you go to /
 #RedirectMatch ^/$ /apache2-default/



use rewrite rules

sudo a2enmod rewrite



Restart Apache


sudo /etc/init.d/apache2 restart