Pages

Showing posts with label Apache Web Server. Show all posts
Showing posts with label Apache Web Server. Show all posts

Linux Virtual Hosting Sample File

This is Sample file for Virtual Hosting for Linux Apache Server
Just COpy and paste and change with your web site.

# VirtualHost template
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf.
# Files must have the .conf suffix to be loaded.
#
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.
#
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

ServerAdmin webmaster@dummy-host.example.com
ServerName www.completeislam.com

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot /home/cislam

# if not specified, the global error log is used
ErrorLog /var/log/apache2/www.completeislam.com-error_log
CustomLog /var/log/apache2/www.completeislam.com-access_log combined

# don't loose time with IP address lookups
HostnameLookups Off

# needed for named virtual hosts
UseCanonicalName Off

# configures the footer on server-generated documents
ServerSignature On


# Optionally, include *.conf files from /etc/apache2/conf.d/
#
# For example, to allow execution of PHP scripts:
#
# Include /etc/apache2/conf.d/mod_php4.conf
#
# or, to include all configuration snippets added by packages:
# Include /etc/apache2/conf.d/*.conf


# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have one, and where ScriptAlias points to.
#

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all



# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES
# in /etc/sysconfig/apache2.
#

# Note that the name of the user directory ("public_html") cannot simply be
# changed here, since it is a compile time setting. The apache package
# would have to be rebuilt. You could work around by deleting
# /usr/sbin/suexec, but then all scripts from the directories would be
# executed with the UID of the webserver.
UserDir public_html
# The actual configuration of the directory is in
# /etc/apache2/mod_userdir.conf.
Include /etc/apache2/mod_userdir.conf
# You can, however, change the ~ if you find it awkward, by mapping e.g.
# http://www.example.com/users/karl-heinz/ --> /home/karl-heinz/public_html/
#AliasMatch ^/users/([a-zA-Z0-9-_.]*)/?(.*) /home/$1/public_html/$2



#
# This should be changed to whatever you set DocumentRoot to.
#


#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all



Configuration of Apache Web Server with virtual hosting

1) Install given necessary packages.
I-apache2-2.0.XXX.rpm
II-apache2-example-page-2.0.XXX.rpm
III-apache2-prefork-2.0.XXX.rpm
IV-apache2-mod-perl-2.0.XXX.rpm (for perl scripting support)
V-apache2-mod_php4-4.3XXX.rpm (for php pages support)
2 ) If you want to host only one site then this so easy. Place your website in /srv/www/htodocs/ folder.

3) Start the apache2 service.
/etc/init.d/apache2 start or rcapache2 start

4) For webhosting your DNS must be work properly and domain must be resolved.

5) For virtual hosting go to /etc/apache2/vhosts.d and copy “vhost.template” to appropriate name of your website. Like www.pucit.edu.pk.conf www.pucitonline.net.conf and so on.


ServerAdmin webmaster@www.pucitonline.net
ServerName www.pucitonline.net

DocumentRoot /home/pucitonline

ErrorLog /var/log/apache2/www.pucitonline.net-error_log
CustomLog /var/log/apache2/www.pucitonline.net-access_log combined







And same changes in all website files.

6) uncomment anyone of these NameVirtualHost 12.34.56.78:80 or
NameVirtualHost *:80 in /etc/apache2/listen.conf

7) start/restart apach2 service through this way.
/etc/init.d/apache2 or rcapache2 start/restart

Forex Trading