LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-24-2005, 08:31 PM   #1
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Rep: Reputation: 15
using symlinks for /home/"username" and /var/www/html


hello All,
i am currently using RHEL 4 and I wont consider myself as a newbie but i do need some help (as all of us do, in some way shape or form). Now I am just learning to configure the Apache Web server but i am not experienced enough with this. I do know that pages are displayed on /var/www/html but i created a webdocs folder in my /home/"syed". i would like to know if there are any scripts so that whatever i do in my home folder, that would be copied over to my /var/www/html folder. For example, if i could just have my webdocs be automatically syncronized with my /var/www/html. Also if i create a new user, is there any way that i could just have the directory copied to both places. Thanks.
Syed Zaidi


 
Old 06-25-2005, 12:16 AM   #2
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
i do something similar, and i think my way is a heck of a lot less trouble.

1) enable userdir support, serving pages from /home/[name]/public_html.

2) in /var/www/html, i just place a symlink of

/var/www/html/syed --> /home/syed/public_html

it ill help to have /home/[directories]/.. readable by apache.

after this, anything you place your your homedirs public_html folder, will be viewable at www.domain.com/syed. now, normally, this exact same concept is accomplished just thru the turning on of the homedir support, without all the symlinks, and just going to www.domain.com/~syed, but i have a few sites that i host, where i just created an account of the domain name, which is held under /home. instead of putting the sites files in /var/www/html, and mucking about with the permissions to allow the user to write via ftp there, i just symlink it back and make a virtual host in my httpd.conf. the virtual host settings say /var/www/html/domainfolder, but its actually a symlink back to /home/domain/public_html. this setup, also make the url of syed.domain.com quite easy to configure as well.

works quite well for me.
 
Old 06-25-2005, 07:56 AM   #3
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Original Poster
Rep: Reputation: 15
Thank you for this help, but I do not know how to create symlinks, However I am in favor in learning. Can you show me how to do this or give a link where the tutorial is quite easy to follow. Surry for buggin you.
Thanks
 
Old 06-25-2005, 09:35 AM   #4
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
sure!

ln -s [sourcefolder] [targetlinkname]

the link can be anyname you like.ill actually use mine as an example. here is my web directory:

Code:
[root@demeter html]# ll
total 16
lrwxrwxrwx  1 root root   30 Jun 25 09:29 dfwlanparty.org -> /home/dfwlanparty/public_html/
drwxrwxr-x  2 root root 4096 Oct 15  2004 dlpadmin
-rw-r--r--  1 root root  593 Jun 17 19:10 index.html
drwxrwxr-x  5 root root 4096 Oct 21  2004 logs
drwxrwxr-x  5 root root 4096 Oct 15  2004 sys
lrwxrwxrwx  1 root root   31 Jun 20 10:13 z71silverado.com -> /home/z71silverado/public_html/
as you can see, i have 2 sites listed, that point back to homedirs, with symlinks. to create them, the least confusing way, would be to cd to /var/www/html, and specify the folder you want linked and the link name right there. the command i gave, would have been like this:

Code:
ln -s /home/dfwlanparty/public_html/ dfwlanparty.org
a very simple, but very useful tool. i *wish* windows servers could do that.
 
Old 06-25-2005, 12:25 PM   #5
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Original Poster
Rep: Reputation: 15
and this would continuasly syncronize both folders
 
Old 06-25-2005, 12:30 PM   #6
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Original Poster
Rep: Reputation: 15
also you said that i need to enable userdir support, how would i do that? surry for buggin u.
 
Old 06-25-2005, 12:48 PM   #7
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
it would not syncronize... it would be the exact folder being served by apache.

to enable userdirs, check /etc/httpd/conf/httpd.conf. it might also be called homedirs, i cant recall off the top of my head, but its one or the other.

Last edited by Sharaz; 06-25-2005 at 10:00 PM.
 
Old 06-25-2005, 04:25 PM   #8
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Original Poster
Rep: Reputation: 15
ok..so if i understand correctly

1) user dirs- will handle all permission so that I can display my pages in /var/www/html

2) a symlink to my home folder from /var/www/html will create a link to my home folder and display it all.

Am i correct?

thanks
 
Old 06-25-2005, 10:03 PM   #9
Sharaz
Member
 
Registered: Jun 2005
Location: Dallas, TX
Distribution: Fedora 11,12, RedHat4,6, CentOS4,5, FreeBSD7,8
Posts: 70

Rep: Reputation: 16
right, but you want to be sure you symlink your /home/syed/public_html and not /home/syed, or you will serve your homedir, and not the webpages you want.

study my above example again, and see how the --> after a name under /var/www/html points to a folder listed under a /home/syed. i wish the colors were like they were in bash. in my example, the symlinks in real life will show up as cyan, and make it easy to tell which ones are links, and which are real folders and files.
 
Old 06-26-2005, 09:30 AM   #10
hamza11050
Member
 
Registered: Jun 2004
Location: NY, USA
Distribution: RHEL 4
Posts: 54

Original Poster
Rep: Reputation: 15
THANK YOU....IT all works welll
 
Old 08-05-2005, 10:36 PM   #11
mio_carpe
Member
 
Registered: Jan 2005
Location: FL, USA
Distribution: Minislack & Gentoo
Posts: 32

Rep: Reputation: 15
Thanks, It help me too!!!
 
  


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
Why "bash-2.05b$" in Terminal instead of "username@localhost username" jayelitumbiolo Linux - General 9 10-04-2009 03:16 AM
"shutdown" and "halt" symlinks: poweroff, reboot. sud_crow Linux From Scratch 11 10-17-2006 11:03 PM
help in /var/www/html/!! chidomen Linux - Newbie 4 01-13-2005 11:02 AM
ownership of /var/www/html haobaba1 Linux - Security 1 08-04-2003 02:58 PM
chmod of /var/www/html alTereD Linux - Security 1 12-16-2002 02:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:03 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