Home networking basics

How to set up a Web Server at home

[1] & [4] have been useful in writing this blog post.

Web Server
Software that continuously runs on a computer and allows other computers to download documents from it - serves web pages to clients who view them using a web browser app.

Apache2 Web Server
Users enter a Uniform Resource Locator (URL) to point to a Web server by means of its Fully Qualified Domain Name (FQDN) and a path to the required resource. For example, to view the home page of the Ubuntu Web site a user will enter only the FQDN. To request specific information about paid support, a user will enter the FQDN followed by a path.

The most common protocol used to transfer Web pages is the Hyper Text Transfer Protocol (HTTP). Protocols such as Hyper Text Transfer Protocol over Secure Sockets Layer (HTTPS), and File Transfer Protocol (FTP), a protocol for uploading and downloading files, are also supported.

Apache Web Servers are often used in combination with the MySQL database engine, the HyperText Preprocessor (PHP) scripting language, and other popular scripting languages such as Python and Perl. This configuration is termed LAMP (Linux, Apache, MySQL and Perl/Python/PHP) and forms a powerful and robust platform for the development and deployment of Web-based applications.

Configuration

Apache2 is configured by placing directives in plain text configuration files. These directives are separated between the following files and directories /etc/apache2:

Files
Pay attention to the file names for description of its contents
  • apache2.conf: the main Apache2 configuration file. Contains settings that are global to Apache2.
  • ports.conf: houses the directives that determine which TCP ports Apache2 is listening on.
  • envvars: 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 foruser specific configuration options that globally effect Apache2.
Directories
Apache Modules
  • mods-available: this directory contains configuration files to both load modules and configure them. Not all modules will have specific configuration files, however.
  • mods-enabled: holds symlinks to the files in /etc/apache2/mods-available. When a module configuration file is symlinked it will be enabled the next time apache2 is restarted.
More configuration files
  • conf.d: contains configuration files which apply globally to Apache2. Other packages that use Apache2 to serve content may add files, or symlinks, to this directory.
1 Apache Server -> Multiple sites
  • sites-available: this directory has configuration files for Apache2 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, the site configured by it will be active once Apache2 is restarted.
In addition, other configuration files may be added using the Include directive, and wildcards can be used to include many configuration files. Any directive may be placed in any of these configuration files. Changes to the main configuration files are only recognized by Apache2 when it is started or restarted. Refer to the basic settings in [2].

Symboilc Link
Special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

Virtual Host
refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site, or "name-based", meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.



Files modified:
apache2 -  sites-available -> jaytest
                  apache2.conf
                  ports.conf
network_test (Web Server root folder) - .htaccess

All the changes that I made in the respective files can be viewed here:

Changes to the router to enable Port Forwarding - a screen shot to give you an idea:



Useful Links:
[1] - 'How to set up a personal home web server' from LifeHacker
[2] - 'Apache 2 web server' from Ubuntu.com
[3] - Info about Virtual Hosts
[4] - 'How to access a home server behind a router/firewall' from LifeHacker

No comments:

Post a Comment