Where is the Apache error log on Ubuntu?

The Apache log is in /var/log/apache2/error.log
If you type in console:

tail -f /var/log/apache2/error.log

This is the way to see all the error while the page is loading.

Posted in Apache, Ubuntu at December 11th, 2011. No Comments.

Maintaining Apache2 sites

Today I will introduction you how to configuring sites in Ubuntu’s Apache 2 package, how easily to add and remove sites. The main source of confusiong comes from the various directories stored beneath /etc/apache2:

sites-available directory:
A list of configuration files – one per site. The system admin can have as many sites here as they need – however – they will not all be active.
sites-enabled directory:
A list of symlinks to configuration files in sites-available. The sites listed here are the sites which will be active.
a2ensite
Will create the correct symlinks in sites-enabled to allow the site configured in sitefilename to be served
a2dissite
Will remove the symlinks from sites-enabled so that the site configured in sitefilename will not be served

Now let’s do it in practice:

Now go to this folder: /etc/apache2/sites-available/ and execute this command:

sudo nano example

In the editor enter this options for your site:


ServerName example.local
ServerAlias *.example.local
DocumentRoot /home/nikola/example.local

Create the folder example.local in your home folder. I prefer to use .local for the name of the folder to remind me this is web site folder. Also this is the extension will be used to make difference between real site and your local site, when you watched it in the browser.

Now execute this command:

sudo nano /etc/hosts

and enter this:
127.0.0.1 example.local

and save the file.Now you must create symlinks in sites-enabled to allow the site. Go to directory /etc/apache2/sites-enabled/ and execute:

sudo a2ensite example

and now restart apache server

sudo /etc/init.d/apache2 restart

If you want to disable example.local site, execute this:

sudo a2dissite example
sudo /etc/init.d/apache2 restart

Go to browser and type example.local.
That’s all, good luck.

Posted in Apache, Ubuntu at December 5th, 2011. No Comments.

How to start stop restart Apache web server in Ubuntu

Hello, today I will show you how to start/stop/restart your Apache server. First you need to use sudo command restart Apache.
To start apache use this command:

sudo /etc/init.d/apache2 start

To stop apache use this command:

sudo /etc/init.d/apache2 stop

To restart apache use this command:

sudo /etc/init.d/apache2 restart

That’s all, good luck.

Posted in Apache, Ubuntu at December 2nd, 2011. No Comments.

Install virtual hosts on Wamp

Today I will show you how to install virtual hosts on Wamp server.

First open your hosts file, you can find it in this folder:
C:\Windows\System32\drivers\etc
to edit it you need to have administrator permissions.

After this line:
127.0.0.1 localhost
add new one with name of your domain:
127.0.0.1 test.local
I prefer to use .local for my virtual domains to know is that virtual or real domain name.
Next step is to open httpd.conf file which is locate in:
\wamp\bin\apache\Apache2.2.17\conf
find this line:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
to enable httpd-vhosts.conf just remove # at the begin of the row. After this open httpd-vhosts.conf for edit.
Add this:

<VirtualHost *:80>
DocumentRoot "C:/wamp/www/test/www"
ServerName test.local
ServerAlias www.test.local
<Directory "C:/wamp/www/test/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from 127.0.0.1
</Directory>
</VirtualHost>

Restart your Wamp server and type in your browser test.local .

Posted in Apache at July 8th, 2011. No Comments.