Name based virtual hosting - shared IP - multiple hostnames on a single machine with a single IP address. The hostname is part of the request to the server. The server uses this information to determine which web site to show the user. This may fail if the user directly types the IP address directly to reach a webhost.
-create mysite.local.conf in /etc/apache2/sites-available
-(add the below to mysite.local.conf)
<virtualhost *:80>
ServerName mysite.local
DocumentRoot /home/user/www/mysite.local
</VirtualHost>
(apache actually looks for virtual hosts in /etc/apache2/sites-enabled. So create a symbolic link from here to mysite.local.conf with the same name)
sudo ln -s /etc/apache2/sites-available/mysite.local.conf mysite.local.conf
(add to /etc/hosts)
127.0.0.1 mysite.local
So now ,
http://example.local gets to page at /var/www
http://mysite.local gets to page at /home/user/www/mysite.local
Sunday, October 31, 2010
Monday, October 18, 2010
Integrating phpMyAdmin into Apache
(edit apache configuration file)
gksudo gedit /etc/apache2/apache2.conf
(-add this line)
Include /etc/phpmyadmin/apache.conf
(restart apache)
sudo /etc/init.d/apache2 restart
(Fire up the browser and point to)
http://localhost/phpmyadmin/
gksudo gedit /etc/apache2/apache2.conf
(-add this line)
Include /etc/phpmyadmin/apache.conf
(restart apache)
sudo /etc/init.d/apache2 restart
(Fire up the browser and point to)
http://localhost/phpmyadmin/
Labels:
LAMP
Saturday, October 9, 2010
Directing http://example.local
DNS servers used are stored in /etc/resolv.conf
If the IP address is listed in the /etc/hosts file,the name servers are not used.
127.0.0.1 example.local
(add to /etc/hosts so that http://example.local reaches localhost)
If the IP address is listed in the /etc/hosts file,the name servers are not used.
127.0.0.1 example.local
(add to /etc/hosts so that http://example.local reaches localhost)
Labels:
LAMP
Very Basic Local Hosting
For client-server access the socket needs three things to provide service or ask for service.
Service name (eg. www)
Protocol (eg. http)
Port no (eg. 80)
The service uses protocol and protocol uses port number to provide service at server end and to get service at client end. Services may have same protocol but not the same port number(eg. telnet and ftp)
/etc/protocols - file shows protocols supported by Linux
/etc/services - file shows services supported by Linux
/etc/apache2 - root directory of Apache Web server
/var/www - DocumentRoot(as configured in the file /etc/apache2/sites-available/default )
Service name (eg. www)
Protocol (eg. http)
Port no (eg. 80)
The service uses protocol and protocol uses port number to provide service at server end and to get service at client end. Services may have same protocol but not the same port number(eg. telnet and ftp)
/etc/protocols - file shows protocols supported by Linux
/etc/services - file shows services supported by Linux
/etc/apache2 - root directory of Apache Web server
/var/www - DocumentRoot(as configured in the file /etc/apache2/sites-available/default )
Labels:
LAMP
Friday, October 8, 2010
Apache-MySQL-PHP
Ubuntu Release 10.04(lucid)
(install apache webserver)
sudo apt-get install apache2
(to test apache)
http://localhost/
(install php and its apache module)
sudo apt-get install php5 libapache2-mod-php5
(restart apache)
sudo /etc/init.d/apache2 restart
(to test php)
1.(create testphp.php in DocumentRoot Folder given in /etc/apache2/sites-available/default)
gksudo gedit /var/www/testphp.php
2.(add this line to testphp.php)
<?php phpinfo(); ?>
3.(test whether the phpfunction gets executes)
http://localhost/testphp.php
(install mysql)
sudo apt-get install mysql-server
(to make the mysql services visible on this ipaddress for the network)
(open my.cnf)
gksudo gedit /etc/mysql/my.cnf
(change bind address)
bind-address = 192.168.1.2
(install phpmyadmin and mysql modules for apache and php)
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
(enable mysql for php)
(open php.ini)
gksudo gedit /etc/php5/apache2/php.ini
(uncomment ;extension=mysql.so)
extension=mysql.so
(restart apache)
sudo /etc/init.d/apache2 restart
(install apache webserver)
sudo apt-get install apache2
(to test apache)
http://localhost/
(install php and its apache module)
sudo apt-get install php5 libapache2-mod-php5
(restart apache)
sudo /etc/init.d/apache2 restart
(to test php)
1.(create testphp.php in DocumentRoot Folder given in /etc/apache2/sites-available/default)
gksudo gedit /var/www/testphp.php
2.(add this line to testphp.php)
<?php phpinfo(); ?>
3.(test whether the phpfunction gets executes)
http://localhost/testphp.php
(install mysql)
sudo apt-get install mysql-server
(to make the mysql services visible on this ipaddress for the network)
(open my.cnf)
gksudo gedit /etc/mysql/my.cnf
(change bind address)
bind-address = 192.168.1.2
(install phpmyadmin and mysql modules for apache and php)
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
(enable mysql for php)
(open php.ini)
gksudo gedit /etc/php5/apache2/php.ini
(uncomment ;extension=mysql.so)
extension=mysql.so
(restart apache)
sudo /etc/init.d/apache2 restart
Labels:
LAMP
Subscribe to:
Posts (Atom)