LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-25-2017, 02:16 AM   #1
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Rep: Reputation: Disabled
Apache help


I am a complete newbie and I feel dumb. Anyway I moved the document root from /var/www/html to /home/user/public_html I noticed that is owned by root which I know is bad.

Now I found out Apache is run under www-data. Now do I chown it to www-data or to the user and add the user to Apache group? That is what is confusing me.

Also how do I find out if my server is running SuExec and/or SuPHP? thanks
 
Old 01-25-2017, 11:11 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi and welcome to LQ,

You should tell us your distro and apache version, so we could give you better advice

Quote:
Now I found out Apache is run under www-data. Now do I chown it to www-data or to the user and add the user to Apache group? That is what is confusing me.
There is no need to do anything as long as file permissions are 644 and directory permissions 755. I would advice though that you leave anything owned by the user in question.


Quote:
Also how do I find out if my server is running SuExec and/or SuPHP? thanks
Check the apache error_log to see if suexec is enabled
For suPHP check if the module is loaded. Depending on distro (RHEL or Debian based), you can run respectively:
Code:
httpd -M|grep suphp
apache2ctl -M|grep suphp
Regards
 
Old 01-25-2017, 12:00 PM   #3
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Original Poster
Rep: Reputation: Disabled
I am running Ubuntu 16

what I did was the following:

sudo adduser username

sudo adduser username www-data

Now I have to figure out to move /var/www to /home/user/public_html
 
Old 01-25-2017, 12:35 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Now I have to figure out to move /var/www to /home/user/public_html
You can edit /etc/apache2/sites-available/000-default.conf and change there the default docroot.
Don't forget to backup the files you are changing

For a complete tutorial about configuring apache and vhosts on ubuntu take a look here
 
Old 01-25-2017, 12:44 PM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,308
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by drillsar View Post
Now I have to figure out to move /var/www to /home/user/public_html
One way is with mod_userdir:

http://www.techytalk.info/enable-use...distributions/

About the permissions, you it's fine for the directories to be owned by root. But if you want to edit them yourself, then you might want to change owner or group:

https://www.linuxquestions.org/quest...e-users-37043/

About the only thing you don't want to do is make the files or directories owned by the user or group www-data. The reason is that you don't want to end up in the situation where the web server could ever, ever write to anything it is serving. Bathory's suggestions for permissions work well, though you can get more complex if you are sharing write access to many users.
 
  


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
Apache close wait error :Apache stop responding,Server get hangs jsaravana87 Linux - Server 1 06-19-2012 11:49 AM
setting up apache from scratch on a linux machine, apache failed message upon bootup dramous43 Linux - Enterprise 2 01-26-2010 07:53 AM
Apache Webserver on Slackware - Failed to Start Apache - 'no listening sockets .." CCTVGuru Linux - Server 4 10-11-2009 01:14 AM
Mail from Apache being rejected - Cannot route to sender apache@localhost.localdomain jimwillsher Linux - Networking 2 01-19-2006 12:41 AM
apache benchmarks (apache v13 / apache v20) ; large differences between benchmarking markus1982 Linux - Software 0 02-08-2003 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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