LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 02-08-2012, 10:41 AM   #1
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Rep: Reputation: 10
Apache : userdir vs VirtualHost


hi everybody.i have a question.what's the difference between userdir and virtual host in apache.i know that with userdir the domain name of the website is unique and we make difference between website with user accounts.for example these website can be hosted on the same web server running apache:
1.http://www.example.com/~u1
2.http://www.example.com/~u2
.
.

...etc.

and i know that with virtual host we can have different domain name, like IIS.
but the thing i don't get is what's the difference.in what situations we use userdir and in what situations we use virtual host.

if someone explain it to me, i'd appreciate it.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-08-2012, 10:46 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Virtual Host if you want a unique domain name for each site.
userdir if you just want users to have a page under your main domain name using www.domain.com/~username for their website address.
 
1 members found this post helpful.
Old 02-09-2012, 03:48 AM   #3
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
thank you TenTenths.one more question.when i'm using virtual host what's the regular path for html file.can i use public_html in home directory or should i create a directory in /var/www.which one is the common configuration ?
 
1 members found this post helpful.
Old 02-09-2012, 03:59 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
In the past I've used both approaches, for example at work I use /var/www/html/www.example.com but on my own servers I tend to use /home/username/public_html for the html files and /home/username/logs for the log files.

If you're doing this for a number of users then I would suggest using the /home/username/public_html /home/username/logs method, that way you can chroot jail their shell/ftp to /home/username and that way they can still make their site changes and access their log files.
 
2 members found this post helpful.
Old 02-09-2012, 04:04 AM   #5
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS, CloudLinux
Posts: 377

Original Poster
Rep: Reputation: 10
thank you so much.
 
1 members found this post helpful.
  


Reply



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
Virtualhost UserDir mashiox Linux - Server 8 01-31-2009 02:10 PM
Apache UserDir ]SK[ Linux - Software 4 06-18-2005 12:10 PM
Apache userdir. collen Linux - Networking 1 01-28-2005 12:24 PM
Apache UserDir Abbaddon Slackware 12 09-15-2004 11:28 AM
Userdir's under SuSE w/ apache Code_Zero Linux - Distributions 5 08-21-2002 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration