Web server on xp - Chapter 24 . Running a Linux, Apache, MySQL,

Chapter 24 . Running a Linux, Apache, MySQL, and PHP (LAMP) Server 657 Location blocks (in the generic sense) can be enclosed within a VirtualHost block. Virtual hosts, which are described in greater detail in the next section, are a convenient (and almost essential) tool for altering server behavior based on the server address or name that a request is directed to. Most global configuration options are applied to virtual hosts but can be overridden by directives within the VirtualHost block. Adding a Virtual Host to Apache Apache supports the creation of separate Web sites within a single server to keep content separate. Individual sites are configured in the form of virtual hosts, which also are useful when only a single site will be used. Here s how to configure a virtual host: Create a file named /etc/apache/conf.d/vhosts.conf using this template: NameVirtualHost *:80 ServerName www.example.org ServerAlias web.example.org DocumentRoot /home/username/public_html/ User username Group groupname DirectoryIndex index.php index.html index.htm The NameVirtualHost line tells Apache to determine which virtual host to serve documents from based on the hostname provided by the HTTP client. The *:80 means that requests to port 80 on any IP address will be treated in this manner. Similarly, the *:80 specification in the VirtualHost block indicates what address and port this virtual host applies to. The port is optional for both the NameVirtualHost and VirtualHost specifications but should always be used to prevent interference with SSL virtual hosts. The ServerName and ServerAlias lines tell Apache which names this virtual host should be recognized as, so replace them with names appropriate to your site. You can leave out the ServerAlias line if you do not have any alternate names for the server, and you can specify more than one name per ServerAlias line or have multiple ServerAlias lines if you have several alternate names.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply