Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-12-2010, 08:28 AM   #1
Registered: Jul 2010
Posts: 83

Rep: Reputation: 15
Question Apache2 n00b.

We have a webserver that currently serves data to our clients. It is IP based and no DNS entry is assigned to if from the outside world.

We now wish to use this server to also host another site, one that will use

I have looked at virtual host documentation online, but alot of it is 10+ year old, or for older version of Apache. We want to be able to access a new site from, whilst still being ok to serve data via IP from \var\www\htdocs


Old 08-12-2010, 08:41 AM   #2
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 70

Rep: Reputation: 25
What distro are you using? Is this for Apache2?

Here is a template which you can use.

On my SuSE system I simple save the file in /etc/apache2/vhosts.d with the .conf extension to make sure it is included when Apache2 loads.

You could build in these directives into /etc/apache2/httpd.conf

<VirtualHost *:80>
# 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 /srv/www/vhosts/
# if not specified, the global error log is used
ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ 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/php5.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/"
# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have one, and where ScriptAlias points to.
<Directory "/srv/www/vhosts/">
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.
<IfModule mod_userdir.c>
# 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.
# --> /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.
<Directory "/srv/www/vhosts/">

# 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
# for more information.
Options Indexes 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

Old 08-12-2010, 10:01 AM   #3
Registered: Jul 2010
Posts: 83

Original Poster
Rep: Reputation: 15
hello, it is debian and apache2


apache, host, virtual, webserver

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Compiling my own apache2 on debian -- no /usr/sbin/apache2 ??? jippen Linux - Server 2 11-30-2009 04:21 AM
Apache2 - have to restart apache2 process every 10 mins to clear /tmp directory.... levi dehaan Linux - Software 8 09-01-2009 07:34 PM
Apache2 - how to get rid of apache2-default ozymandias Linux - Server 4 09-12-2008 11:27 AM
SuSe Apache2 error: cannot adjust 'apache2' service sir_shunt SUSE / openSUSE 14 04-18-2006 12:36 PM
how to uninstall apache2 which is installed by emerge apache2 flybirdlong Linux - Software 1 07-17-2004 12:46 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration