LinuxQuestions.org
Help answer threads with 0 replies.
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-16-2016, 11:28 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
having slight prob getting a localhost (virtual host) up and running properly


I'm trying to setup a localhost Virtual webpage sight. nothing fancy.
this is as far as I got. now I am getting a Error 403 access forbidden.

I know it has to be the httpd.conf I just do not know where. the link to the instructions is here, and his httpd.conf looks like this guy declairs a VirtualHost in that file in an area that calls for it, then again in the vhosts.conf by creating a new dir to vhosts then a file.

whereas My setup has within the httpd.conf a path to lookin /httpd/extras/httpd-vhosts.conf

was using this page for how to instructions

this is all french to me:

my:
httpd-vhosts.conf
Code:
<VirtualHost brainwave.bw:80>
    ServerAdmin ausername@mail.com
    ServerName  brainwave.bw
    ServerAlias www.brainwave.bw
    DocumentRoot /www/brainwave.bw/html
    ScriptAlias /srv/httpd/cgi-bin/ /www/brainwave.bw/html/cgi-bin/
    ErrorLog "/www/brainwave.bw/logs/brainwave.bw-error_log"
    CustomLog "/www/brainwave.bw/logs/brainwave.bw-access_log" common
</VirtualHost>
Code:
%userx@voided ~>>$sudo httpd -S
VirtualHost configuration:
127.0.0.1:80           brainwave.bw (/etc/httpd/extra/httpd-vhosts.conf:41)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/srv/httpd"
Main ErrorLog: "/var/log/httpd/error_log"
Mutex proxy-balancer-shm: using_defaults
Mutex proxy: using_defaults
Mutex default: dir="/var/run/httpd/" mechanism=default 
PidFile: "/var/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="httpd" id=989
Group: name="httpd" id=989
here is my homemade www directory structure, user, owner, permissions
Code:
[root@voided brainwave.bw]# ls -la /www/
total 12
drwxr-xr-x  3 root      root      4096 Feb 16 10:18 .
drwxr-xr-x 19 root      root      4096 Feb 16 10:18 ..
drwxr-xr-x  5 brainwave brainwave 4096 Feb 16 10:19 brainwave.bw
[root@voided brainwave.bw]# ls -la /www/*
total 20
drwxr-xr-x 5 brainwave brainwave 4096 Feb 16 10:19 .
drwxr-xr-x 3 root      root      4096 Feb 16 10:18 ..
drwxr-xr-x 2 mysql     mysql     4096 Feb 16 10:19 databases
drwxr-xr-x 3 brainwave brainwave 4096 Feb 16 10:43 html
drwxr-xr-x 2 brainwave brainwave 4096 Feb 16 10:44 logs
[root@voided brainwave.bw]# ls -la /www/*/*
/www/brainwave.bw/databases:
total 8
drwxr-xr-x 2 mysql     mysql     4096 Feb 16 10:19 .
drwxr-xr-x 5 brainwave brainwave 4096 Feb 16 10:19 ..

/www/brainwave.bw/html:
total 16
drwxr-xr-x 3 brainwave brainwave 4096 Feb 16 10:43 .
drwxr-xr-x 5 brainwave brainwave 4096 Feb 16 10:19 ..
drwxr-xr-x 2 brainwave brainwave 4096 Feb 16 10:18 cgi-bin
-rw-r--r-- 1 userx     brainwave   95 Feb 16 09:33 index.html

/www/brainwave.bw/logs:
total 16
drwxr-xr-x 2 brainwave brainwave 4096 Feb 16 10:44 .
drwxr-xr-x 5 brainwave brainwave 4096 Feb 16 10:19 ..
-rw-r--r-- 1 root      root       476 Feb 16 10:54 brainwave.bw-access_log
-rw-r--r-- 1 root      root      1267 Feb 16 10:54 brainwave.bw-error_log

I think the problem may lay within this area, but I have moded it a few times between going from one how to set this up to another page of how to set this up always getting stuck on I am sure a rather easy fix.

Code:
ServerRoot "/etc/httpd"

# Mutex default:/var/run/httpd
User httpd
Group httpd

ServerName 127.0.0.1:80

#maybe this
<Directory />
    AllowOverride none
    Require all denied
</Directory>

##or this

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/srv/httpd"
<Directory "/srv/httpd">


# Virtual hosts
Include /etc/httpd/extra/httpd-vhosts.conf
though it makes mention of using aliases I'd like to know more about how to format that and what it is all about too.


If I have not given enough information let me know whats missing.

thanks
 
Old 02-16-2016, 12:02 PM   #2
dr_agon
Member
 
Registered: Sep 2007
Location: Poland
Distribution: Ubuntu LTS
Posts: 105
Blog Entries: 12

Rep: Reputation: 26
You did not write what URL are you trying to access.

Look also at the logs.
 
Old 02-16-2016, 12:20 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by dr_agon View Post
You did not write what URL are you trying to access.
like in the web address area in a browser?

it'd be rather self explanatory don't you think?

The title is " having slight prob getting a localhost (virtual host) up and running properly"

it is a localhost web server.

Code:
<VirtualHost brainwave.bw:80>
    ServerAdmin ausername@mail.com


    ServerName  brainwave.bw


    ServerAlias www.brainwave.bw
    DocumentRoot /www/brainwave.bw/html
    ScriptAlias /srv/httpd/cgi-bin/ /www/brainwave.bw/html/cgi-bin/
    ErrorLog "/www/brainwave.bw/logs/brainwave.bw-error_log"
    CustomLog "/www/brainwave.bw/logs/brainwave.bw-access_log" common
</VirtualHost>
 
Old 02-16-2016, 12:23 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
Code:
    DocumentRoot /www/brainwave.bw/html
Code:
%userx@voided ~>>$sudo httpd -S
shows the apache user:group
Code:
User: name="httpd" id=989
Group: name="httpd" id=989
Therefore:
Code:
chmod httpd:httpd /www/brainwave.bw/html -R
 
Old 02-16-2016, 12:35 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Habitual View Post
Code:
%userx@voided ~>>$sudo httpd -S
shows the apache user:group
Code:
User: name="httpd" id=989
Group: name="httpd" id=989
Therefore:
Code:
chmod httpd:httpd /www/brainwave.bw/html -R
adding that one dir/structure will that effect it if more virtual servers are added, or just add them just like you tell me to do with this one.

and should it not read

Code:
chmod -R httpd:httpd /www/brainwave.bw/html
again for the rights to write to the ../html dir I have it set owner:group is brainwave.


what you gave me does not work either way

Code:
 %userx@voided 12:23:01 ~ >>$ sudo chmod -R httpd:httpd /www/brainwave.bw/html
chmod: invalid mode: ‘httpd:httpd’
Try 'chmod --help' for more information.

 %userx@voided 12:29:11 ~ >>$1 sudo chmod  httpd:httpd /www/brainwave.bw/html -R
chmod: invalid mode: ‘httpd:httpd’
.....



then I added my user name to that group, but cannot get permissions to mv files into its directory, root owns /www

but everything under it is owner:group brainwave

brainwave:x:1001: my-user-name
 
Old 02-16-2016, 12:39 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
@Habitual

I'm going to give this a shot. I just found it.

Code:
Using Unix Groups

Most users will want to be able to modify their content without being root. The easiest way to achieve this is through the use of Unix Groups; you create a group to which you add your content editing user, then you add the httpd user to that group.

Note that this doesn't easilly extend to more than one user who needs to edit the files, since at that point you need to set Group write on the files. One would need to use ACL's to achive this.

For example, we have a user "alice" who needs to edit our content, stored in /var/www/html/

First we create the content group, then we add both alice and apache to it.

# groupadd web-content 
# usermod -G web-content alice
# usermod -G web-content apache

Now we need to set the right permissions on our files.

# chown -R alice:web-content /var/www/html
# find /var/www/html -type f -exec chmod 640 {} \;
# find /var/www/html -type d -exec chmod 750 {} \;

What we've done here is to set all files to 640, or rw-r----- and directories to rwxr-x---. Because the group "web-content" is applied to all the files and directories, httpd can read these files, but cannot write to them.
YEP that did it as far as writting to the dir, now I need to get it working on the client side.



Code:
 %userx@voided 12:32:34 ~ >>$1 su
Password:
[root@voided userx]# groupadd www-content
[root@voided userx]# usermod -aG www-content userx
[root@voided userx]# usermod -aG www-content httpd
[root@voided userx]# chown -R userx:www-content /www/brainwave.bw
[root@voided userx]# find /www/brainwave.bw/html -type f -exec chmod 640 {} \;
[root@voided userx]# find /www/brainwave.bw/html -type d -exec chmod 750 {} \;
[root@voided userx]# exit
exit
 %userx@voided 12:41:31 ~ >>$ cd
 %userx@voided 12:41:32 ~ >>$ mv phpinfo.php /www/brainwave.bw/html

Last edited by BW-userx; 02-16-2016 at 12:46 PM.
 
Old 02-16-2016, 12:52 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
chmod -R ...
or
chmod ... -R
same thing.

httpd needs to be able to "read" any DocumentRoot, else 403
If the user wants to "edit" his content in place, add that user to the httpd group.

755 is usual for directories
644 is usual for files.

Last edited by Habitual; 02-16-2016 at 12:53 PM.
 
Old 02-16-2016, 01:00 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
OK I got it, I added these two things in :

/etc/httpd/httpd.conf

Code:
<Directory /www/brainwave.bw/html>
Order Deny,Allow
Allow from all
</Directory>

Alias /webpath /www/brainwave.bw/html
 
Old 02-16-2016, 01:06 PM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Habitual View Post
Code:
chmod -R ...
or
chmod ... -R
same thing.

httpd needs to be able to "read" any DocumentRoot, else 403
If the user wants to "edit" his content in place, add that user to the httpd group.

755 is usual for directories
644 is usual for files.
I got it read the two my post above this one...

got it so I can mv files into (write) to the directory/structure just by my user login, and my client side working now

you had the right idea but wrong method and I had to add a few more lines to conf as well...

Thanks 4 ur Input

Last edited by BW-userx; 02-16-2016 at 01:07 PM.
 
Old 02-16-2016, 01:07 PM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Glad it worked out.
 
Old 02-16-2016, 01:13 PM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Me 2 now I got to attack it
 
Old 02-16-2016, 03:26 PM   #12
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Sweet now I got two Virtual Hosts talking to each other through html
 
Old 02-16-2016, 04:12 PM   #13
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
That's what I call "experience".
 
Old 02-16-2016, 04:17 PM   #14
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
are you experienced?
Ah! Have you ever been experienced?
Well, i have

jimmy h.

Last edited by BW-userx; 02-16-2016 at 04:18 PM.
 
  


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
[SOLVED] Issue with ssh connection between Centos host OS and Ubuntu 10.04 Running on Virtual sriramdas Linux - Virtualization and Cloud 2 01-16-2013 09:00 PM
Access server running on localhost on host system through virtualbox guest OS Jean-Luc Besson Linux - Virtualization and Cloud 3 05-15-2012 03:19 PM
[SOLVED] Virtual Host not working properly newbie67 Linux - Software 7 03-08-2012 02:37 AM
[SOLVED] unicornscan - (Is the server running on host "localhost" ?) lee_can Linux - Newbie 5 04-21-2011 01:09 PM
Running Fedora 14 as virtual machine on Windows 7 Host/can ping no internet JHuff15 Linux - Newbie 5 02-05-2011 04:57 PM

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

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