PDA

View Full Version : How do you post your html/php files to /var/www?



vayu
September 16th, 2005, 06:10 PM
I've got Apache, PHP and MySQL all installed and working well. I've been using "sudo cp" in terminal mode to copy my php and html files into /var/www to make them show up on my browser under localhost. Is there an easier GUI way to do this? This system is just for my local use, after development I will upload them to a server connected to the web, so there are no security issues to be concerned about, I'm only interested in convenience.

KingBahamut
September 16th, 2005, 06:22 PM
I've got Apache, PHP and MySQL all installed and working well. I've been using "sudo cp" in terminal mode to copy my php and html files into /var/www to make them show up on my browser under localhost. Is there an easier GUI way to do this? This system is just for my local use, after development I will upload them to a server connected to the web, so there are no security issues to be concerned about, I'm only interested in convenience.
I think NVU supports such a "publishing"-esque type feature. Bluefish does too I think. You could probably use either of those. Quanta Plus may as well.

I have a directory that I dump all my finished stuff into, and a shell script that dumps them into the proper folders on /var/www , so id never use such a feature in either of the above mentioned progs.

fjleal
September 16th, 2005, 10:34 PM
This system is just for my local use, after development I will upload them to a server connected to the web, so there are no security issues to be concerned about, I'm only interested in convenience.
Try "chown <your_user_name>:<your_user_name> /var/www". Also ensure others can read the files. This way, you may freely copy your files to /var/www, and edit'em directly from there.

JEDIDIAH
September 16th, 2005, 10:40 PM
Why not just put your own development stuff under ~/public_html and have http://localhost/~you be where you test all of your html/php?

vayu
September 17th, 2005, 06:36 AM
Thanks everyone for all the good ideas.


Why not just put your own development stuff under ~/public_html and have http://localhost/~you be where you test all of your html/php?

Are these directory assignments already set up through Apache or do I have to set Apache to look there?

der_joachim
September 17th, 2005, 09:55 AM
Why not just put your own development stuff under ~/public_html and have http://localhost/~you be where you test all of your html/php?

Ooohhh I know this one! I had some issues with file writing in PHP. When the webserver tries to write a file in your homedir, by default that will not be possible. A simple chmod dows the trick, hoewver. ;)

mostwanted
September 17th, 2005, 02:52 PM
I've got Apache, PHP and MySQL all installed and working well. I've been using "sudo cp" in terminal mode to copy my php and html files into /var/www to make them show up on my browser under localhost. Is there an easier GUI way to do this? This system is just for my local use, after development I will upload them to a server connected to the web, so there are no security issues to be concerned about, I'm only interested in convenience.

what about $ sudo nautilus?

deuce868
September 17th, 2005, 07:05 PM
Where are your dev files now? Why not just setup a folder in /home/$user/webdev

Then in your apache2 config change the web root from /var/www to /home/$user/webdev

Let's all be happy now.

JEDIDIAH
September 19th, 2005, 09:29 PM
Thanks everyone for all the good ideas.



Are these directory assignments already set up through Apache or do I have to set Apache to look there?

I don't remember. I'm pretty sure it's in the standard httpd.conf,
even if it's commented out to begin with. Either way, this is a one
time change as root instead of ongoing maintenance.

Here's the relevant section from my httpd.conf file:


#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
UserDir public_html
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Order deny,allow
Deny from all
</Limit>
</Directory>
</IfModule>

majikstreet
September 19th, 2005, 09:35 PM
<Directory /home/*/public_html>


I believe that is the relevant part :)

blastus
September 20th, 2005, 06:14 AM
Why not create a soft link in /var/www to a directory in your home directory? That way you don't have to mess with permissions or chown /var/www.

David Marrs
September 20th, 2005, 03:47 PM
Why not create a soft link in /var/www to a directory in your home directory? That way you don't have to mess with permissions or chown /var/www.
I was about to suggest the same thing. :)

Rick Z
August 23rd, 2007, 03:30 PM
Hi I was reading how to create php & mysql in this forum. How do you create softlink? I am a newbie in linux. thanks.

mahalie
August 23rd, 2007, 06:45 PM
Where are your dev files now? Why not just setup a folder in /home/$user/webdev

Then in your apache2 config change the web root from /var/www to /home/$user/webdev

Let's all be happy now.

The reason I'd rather not do that is that it's for my corporate intranet and someday I won't be here. If they ever hire another web-dev they should be given ownership rights to /var/www and not some redirect to a user directory. Did that make sense? Or if I change the web root from /var/www to /home/$user/webdev, will everything be preserved if later another webdev came along (suppose I left my job) and it was changed to /home/$newuser/webdev and chown was run for the new user on all the files/dirs copied from my current user to the new user account?

In retrospect, I wish I'd created my account as a generic ITStaff account or Webmaster account instead of my network username. Then pointing to home/webmaster/ for instance, wouldn't be bad.

In the meantime, the following (with the really important recursive switch) finally solved my FTP problem (I wasn't able to upload to certain subdirectories).


chown myusername:myusername /var/www -R