Ubuntu Linux Start / Restart / Stop Apache Web Server

/etc/init.d/apache2 is service script used to start / stop / restart the Apache2 service under Debian or Ubuntu Linux. You need to login as root or use sudo command restart Apache.

Task: Start Apache 2 Server

# /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 start

Task: Restart Apache 2 Server

# /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 restart

Task: Stop Apache 2 Server

# /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 stop

The usual location for Debian-like systems (ubuntu) is to place webfiles under the /var/www/… branch of dirs. That is also the location where apache would look (at least you find it in many example apache config files).
So you could build dirs like that:


You may see such statement:

„Could not reliably determine the server’s fully qualified domain name, using for ServerName”

To fix that problem, you need to edit the httpd.conf file. Open the terminal and type,

sudo gedit /etc/apache2/httpd.conf

By default httpd.conf file will be blank. Now, simply add the following line to the file.

ServerName localhost

Save the file and exit from gEdit. Finally restart the server.

sudo /etc/init.d/apache2 restart
Ubuntu Linux Start / Restart / Stop Apache Web Server

Django – how to view executed queries

You also can use python logging to log all queries generated by Django. Just add this to your settings file.

    'disable_existing_loggers': False,
    'version': 1,
    'handlers': {
        'console': {
            # logging handler that outputs log messages to terminal
            'class': 'logging.StreamHandler',
            'level': 'DEBUG', # message level to be written to console
    'loggers': {
        '': {
            # this sets root level logger to log debug and higher level
            # logs to console. All other loggers inherit settings from
            # root level logger.
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': False, # this tells logger to send logging message
                                # to its parent (will send if set to True)
        'django.db': {
            # django also has database level logging


Also useful some template to show queries in the DEBUG mode:  http://djangosnippets.org/snippets/93/

Django – how to view executed queries

Simple How-To for NUnit in Visual Studio


What is Unit testing?

Unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use. Intuitively, one can view a unit as the smallest testable part of an application. Let me take the example of the ‘Calculator’  for demonstrating the unit testing.


  • Windows 7 as OS
  • Microsoft Visual Studio 2010 as IDE
  • NUnit as Unit Testing Tool


  • Create a new Project with C# Class Library and save it (‘Calculator’ in my example).
  • Rename the class ‘Class1.cs‘ to ‘Operator.cs‘.
  • Add the NUnit frameworks into the ‘Solution Explorer‘ by context-clicking on the project name and then select ‘Add Reference’ menu item.
  • When the Add Reference dialog appears, click on ‘Browse‘ and navigate to C:\Program Files (x86)\NUnit…

View original post 331 more words