How to setup Apache Virtualhost

The term Virtual Host refers to the practice of maintaining more than one web site on one Apache machine or server.

Go to your apache configuration files:

cd /etc/apache2/sites-available

Create a configuration file for your new site. For an example site, http://www.hello.com:

vim hello.com

Add this content to the hello.com file

<VirtualHost *:80>
ServerAdmin me@myserver
DocumentRoot /var/www/hello_webroot/
ServerName www.hello.com
ServerAlias hello.com *.hello.com
CustomLog /var/log/apache2/example.com.log combined
</VirtualHost>

you can also customize to make the log inside webroot

Activate the site by issuing the following command

sudo a2ensite  hello.com

Now reload Apache

sudo /etc/init.d/apache2 restart

or

sudo service apache2 restart

And youre done 🙂

Happy Hacking

How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu

How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu

 

 

 

edit the /etc/apache2/httpd.cong

$sudo vim /etc/apache2/httpd.conf

usually it will be blank…add the following to httpd.conf

ServerName localhost

if httpd.conf contains some data then add at the top like this…

ServerName localhost
<Directory /var/www>
Options Indexes Includes FollowSymLinks MultiViews
#AllowOverride AuthConfig
AllowOverride all
Order allow,deny
Allow from all
</Directory>

Now restart apache the problem is fixed 🙂

$sudo /etc/init.d/apache2 restart

How to Reinstall apache2 properly in GNU/Linux

If you have issues with apache2 and you want to reinstall it but you are getting errors,then here it isthe solution for you.

i had an issue with apache, when i tried to start it i got this error message.

 /etc/init.d/apache2   start.: 45: Can't open /etc/apache2/envvars

i need to remove it completely.To do that i will use this command :

 sudo apt-get remove --purge apache2 apache2-utils
This command will completely remove all apache2 configuration files and directories.
– Reinstall again apache using the normal command
sudo apt-get install apache2

installed phpmyadmin, but i get “404 not found”

I installed PhpMyAdmin on my Ubuntu 10.04  but when I came to test it out I couldn’t get it to work: I just got a 404 Not Found page instead of the PhpMyadmin login page.  I searched the web and found out a soltion.A small hack must be done on apache’s confighuration file to solve this problem .Edit /etc/apache2/apache2.conf

vim /etc/apache2/apache2.conf

Add this to the bottom of the file

Include /etc/phpmyadmin/apache.conf

then restart apache as root.


/etc/init.d/apache2 restart

How to fix apache the problem i faced!!!!!!!!

While trying ti install moinmoin a python based wiki engine i faced a weird problem with apache server after installtion when i tried to restart apaches it displayed a n error like this…..

* Restarting web server apache2                                                                               apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
… waiting ..apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

This is how i solved the problem…..


ganesh@linux:~$ sudo kate /etc/apache2/httpd.conf

am now using kubuntu so i used kate as text editor instead of kate u can use gedit,vi etc

By default httpd.conf file will be blank. Now, simply add the following line to the file.
ServerName localhost
Save and exit the text editor
Now restart the apache using the command

sudo /etc/init.d/apache2 restart

my screenshots are given below discard the errors shown while opening the file with kate k….

Happy Hacking………….