LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache help (https://www.linuxquestions.org/questions/linux-newbie-8/apache-help-4175598199/)

drillsar 01-25-2017 02:16 AM

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

bathory 01-25-2017 11:11 AM

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

drillsar 01-25-2017 12:00 PM

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

bathory 01-25-2017 12:35 PM

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

Turbocapitalist 01-25-2017 12:44 PM

Quote:

Originally Posted by drillsar (Post 5660056)
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.


All times are GMT -5. The time now is 02:30 PM.