LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-25-2010, 02:34 AM   #1
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Rep: Reputation: 17
Virtual Hosts Setup


Hello there! I asked this in a previous thread, but asked in a completely wrong way. After some research I found a better way to ask this. I need to set up virtual hosts I think. This is what I need.

I have a server set up with apache2 to host my website in /var/www/ (e.g. www.domain.com). My friend wants me to host her site as well. So I put her files in /var/www/rosie. What i want to happen is she go to www.domain.com/rosie/ to access her site. How can I set this up? Please be detailed because after much research I'm still confused.

Thanks!
 
Old 01-25-2010, 02:57 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hello,

Have a look at http://www.howtoforge.com/. They have a lot of easy to follow step by step guides for what you're looking for.

Kind regards,

Eric
 
Old 01-25-2010, 04:17 AM   #3
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Wait....

You have a website www.domain.com what's document root is /var/www/ and you want your friend's site to be www.domain.com/rosie so you place her documents in /var/www/rosie/.

This shouldn't require any additional configuration what so ever. If it's not working are you sure you got the correct documentroot, that the documentroot is not really /var/www/html/?
 
Old 01-25-2010, 04:48 AM   #4
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
I'm Positive. This is why I'm SO FRICKIN CONFUSED!!!!! help?!?!?!?! Before I pull out all my hair?
 
Old 01-25-2010, 05:40 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,446
Blog Entries: 11

Rep: Reputation: 182Reputation: 182
Quote:
Originally Posted by LazerPhreak View Post
Before I pull out all my hair?
Stop pulling hair. Push us the config your using for the apache.
/etc/apache2/apache.conf

Also give us a listing of /etc/apache2
 
Old 01-25-2010, 04:52 PM   #6
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
Sorry for the aggravated response. That was at 6 am after near 13 hours straight working on it with failure. After a nights rest I'm ready to tackle it fresh.

Heres my directory listing of /etc/apache2:

Code:
-rw-r--r-- 1 root root  8135 2010-01-25 04:31 apache2.conf
-rw-r--r-- 1 root root  8097 2010-01-18 21:35 apache2.conf.bak
drwxr-xr-x 2 root root  4096 2010-01-25 04:13 conf.d
-rw-r--r-- 1 root root   551 2009-11-12 16:48 envvars
-rw-r--r-- 1 root root     0 2010-01-18 21:33 httpd.conf
-rw-r--r-- 1 root root 31063 2009-11-12 16:48 magic
drwxr-xr-x 2 root root  4096 2010-01-18 21:33 mods-available
drwxr-xr-x 2 root root  4096 2010-01-18 21:33 mods-enabled
-rw-r--r-- 1 root root   481 2010-01-25 04:43 ports.conf
drwxr-xr-x 2 root root  4096 2010-01-25 04:38 sites-available
drwxr-xr-x 2 root root  4096 2010-01-25 04:40 sites-enabled
This is apache2.conf
Code:
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.l$
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#
ServerTokens Prod
ServerSignature Off
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#
#<IfModule !mpm_winnt.c>
#<IfModule !mpm_netware.c>
LockFile /var/lock/apache2/accept.lock
#</IfModule>
#</IfModule>

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-For$
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"$
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" comb$
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined


# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
Some further details that might help:
the destination is http://www.tweakercat.tk (linked to http://75.87.80.77)
So technically http://www.rosebuddweddings.tk (linked to the same) should take you to a white screen that says "This is a test" (index.html) from what I understand

my /var/www:
/var/www
/var/www/default
/var/www/default/index.html

/var/www
/var/www/rosebuddweddings
/var/www/rosebuddweddings/index.html

This is my sites-available setup:

file default:
Code:
NameVirtualHost *
<VirtualHost *>
ServerName www.tweakercat.tk
ServerAlias tweakercat.tk
DocumentRoot /var/www/tweakercat
</VirtualHost>
file www.rosebuddweddings.tk
Code:
<VirtualHost *>
ServerName www.rosebuddweddings.tk
ServerAlias rosebuddweddings.tk
DocumentRoot /var/www/rosebuddweddings
</VirtualHost>
 
Old 01-25-2010, 05:26 PM   #7
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
From what I can see, you have two different domains, tweakercat.tk and rosebuddweddings.tk both of which are pointing to different DocumentRoots. tweakercat should host anything in /var/www/tweakercat and rosebuddweddings /var/www/rosebuddweddings. From here what is it you are trying to accomplish?
 
Old 01-25-2010, 05:33 PM   #8
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
I'm Sorry, I'm going everywhere at once. What I wish to happen is www.tweakercat.tk to point to /var/www/default and www.rosebuddweddings.tk point to /var/www/rosebuddweddings. It seems to me everything on this side is set up properly, but when i go to either domain it sends me to /var/www/default. Maybe I'm forwarding the domains incorrectly? I have both the domains pointing to http://75.87.80.77 . from what I Understand my server should take care of sending the person o the right place. Am i thinking about this all wrong? If so, to what address should I forward the domain? Another thought: www.tk allows me to either forward a domain, use their free dns service, or use a custom dns service. I've just been forwarding the domain. Maybe the problem lies herein? Sorry, but it's kind of hard to ask a logical question, without having a clear problem. Thanks for being patient.
 
Old 01-25-2010, 05:59 PM   #9
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
Holy shit I made an advancement. I changed my domain forwarding from domain forward to using their custom DNS for both domains. I set the A record on both to their specific domains and the ip to 75.87.80.77. IT WORKS!!!! Sorry for the long process to get here, but as I said, lack of clear problem = lack of clear question. Thanks for all your help and support!

Last edited by LazerPhreak; 01-25-2010 at 06:18 PM.
 
Old 01-25-2010, 06:23 PM   #10
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
If I am to understand this right, you were just using forwarding what just does a call on the IP and doesn't actually pass the domain information to the server, thus the server just passed back it's default and not the domains you intended to see? Now the server seems the domains from the requests and redirects people correctly?
 
Old 01-25-2010, 06:29 PM   #11
LazerPhreak
Member
 
Registered: Dec 2009
Location: USA
Distribution: Ubuntu Server / Desktop / UNR
Posts: 117

Original Poster
Rep: Reputation: 17
That is correct. To be honest, I have no experience with linux servers, and only 6 months with linux at all. This whole thing has been a learn as I go, and indeed has taught me alot. Thank god I dont mind learning at the cost of looking like an idiot occasionally lol.
 
Old 01-26-2010, 07:00 AM   #12
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,446
Blog Entries: 11

Rep: Reputation: 182Reputation: 182
Quote:
Originally Posted by LazerPhreak View Post
That is correct. To be honest, I have no experience with linux servers, and only 6 months with linux at all. This whole thing has been a learn as I go, and indeed has taught me alot. Thank god I dont mind learning at the cost of looking like an idiot occasionally lol.
Doing god so far. And idiot would not provide the sites-available config when not asked for. And as you solved your problem on your own your going good

Sometimes just a question from another person gets one self to the right point.

Cheers Zhjim
 
1 members found this post helpful.
  


Reply


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
how do I setup virtual hosts in Apache 2.0.54 on linux canegames Linux - Software 2 06-25-2006 09:27 AM
apache-ssl setup virtual hosts notolerance Linux - Software 3 12-22-2005 04:20 PM
webalizer setup for virtual hosts intranet_man Linux - Security 1 03-03-2005 12:00 PM
Red Hat 9 GUI Virtual Hosts setup yellowjelly Red Hat 2 12-21-2004 06:29 PM
How to setup virtual hosts for a web site? George2 Linux - Software 4 10-21-2003 03:46 AM


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

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