w3resource

Web-server

Web-server

Here is a list of popular open source web servers.

  • Apache
  • LightTPD (YouTube, Meebo, Wikipedia)
  • Nginx
  • Roxen

Apache

Apache's initial release came in the year 1995. It is the most widely used web server around since then.

  • powers 100 million websites (early 2009), over 46% of total
  • Most popular web server since 1996
  • Lineage going back to NCSA HTTPd
  • A comprehensive set of features - you want it, it has it.

Installing Apache

sudo apt-get install apache2

installing-apache2

Apache is installed in /etc/apache2.

installing-apache3
File/Directory Description
apache2.conf The main Apache2 configuration file. Contains settings that are global to Apache2.
conf.d Contains configuration files which apply globally to Apache. Other packages that use Apache2 to serve content may add files, or symlinks, to this directory.
envars File where Apache2 environment variables are set.
httpd.conf Historically the main Apache2 configuration file, named after the httpd daemon. The file can be used for user-specific configuration options that globally effect Apache2.
mods-available This directory contains configuration files to both load modules and configures them.
mods-enabled Holds symlinks to the files in /etc/apache2/mods-available.
ports.conf Houses the directives that determine which TCP ports Apache2 is listening on.
sites-available This directory has configuration files for Apache Virtual Hosts.Virtual Hosts allow Apache2 to be configured for multiple sites that have separate configurations.
sites-enabled Like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available directory. Similarly when a configuration file in sites-available is symlinked it will be active once Apache is restarted.

Works immediately

screen shot

/etc/apache2/sitesavailable/ site_name

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

apache
Port number of site  --><VirtualHost *:80>
Email of webmaster  -->ServerAdmin webmaster@localhost
Root directory of site files  --></Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Static files block  -->
Static files block  -->
Error log file  -->
Access log file  --> 

Multiple sites

Apache supports multiple sites on the same machine. Assign sites by port number, sub-domain, directory name, or any combination of the above.

After any configuration changes, restart Apache

sudo /etc/init.d/apache2 restart

Modules

There are many modules that provide additional functionality.

These modules can be installed and loaded dynamically.

Installs the MySQL authentication module

sudo apt-get install libapache2-mod-authmysql
modules

after press enter key get these result

modules1

Enables the new module and restarts apache

sudo a2enmode auth_mysql
sudo /etc/init.d/apache2 restart

Previous: Backup
Next: Databases



Follow us on Facebook and Twitter for latest update.