Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: Apache again  (Read 7589 times)

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Apache again
« Reply #15 on: February 07, 2006, 04:18:44 pm »

Quote from: bramsyuur
Probably I have not understood well your real problem.
If you indicate me, with accuracy what you want to do, there will help you quite what could.

In Apache there exists the possibility of mounting virtual domains with guidelines totally different from the one that nowadays you have in the server.

Send your needs and the name of directories where you want that they aim at the information and I will mount the correct structure.

I think you got me wrong. I want to use this server for my personal use. It won't be for online purposes.

The case is this:
In PHP project that I have, all paths are /home/webmaster/html
So the only logic thing to do is to either change document root or to create alias to point to that directory.

I've succesfully created alias, but now I get Forbidden which is probably due to some CHMOD or owner/group issues or something else that I've missed.


Logged

Rehuel Lobato de Mesquita

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
Apache again
« Reply #16 on: February 07, 2006, 04:30:05 pm »

Luka,

EDIT-> The problem is that the user to browse the document root has no permissions to browse the /home/webmaster directory. It is forbidden for that user to access that directory


first find out what the username is apache uses:

Make a php file somewhere:
Code: [Select]
echo exec("whoami");
?>

In your browser it should display the ussername (ie nobody or apache)

now change ownership of that directory to that user

In shell, as root:
Code: [Select]
chown -R user:group /home/webmasterwhere user is the userid you saw in the browser and group is the group to which it belongs. In most cases it's eighter apache:apache or nobody:nobody

then try to restart apache

If this doesnt help, just reset it back to what you had and consider this suggestion non-existent.
Logged
Stretsh Out...

Procrastination is like masturbation. You do it till you figure out you're only screwing yourself!

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
Apache again
« Reply #17 on: February 07, 2006, 04:37:55 pm »

Luka,
Try this, please! :
(in the bottom of your http.conf

Code: [Select]
alias /name-of-the-alias-that-you-want /the/real/directory/where/the/stuff/are

    Options FollowSymLinks
    Options +Indexes
    Options +Includes
    AllowOverride FileInfo
    order deny,allow
    deny from all
    allow from all

And restart apache!
I hope this helps!
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Español

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Apache again
« Reply #18 on: February 07, 2006, 04:47:49 pm »

Now I can't get localhost to display anything.. I can't believe this is so hard..

Thanks guys, let me just make this work first.
Logged

Rehuel Lobato de Mesquita

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
Apache again
« Reply #19 on: February 07, 2006, 04:54:13 pm »

my bad

the chown has to be to the alias you created

Code: [Select]
chown -R alias:group /home/webmaster
Logged
Stretsh Out...

Procrastination is like masturbation. You do it till you figure out you're only screwing yourself!

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Apache again
« Reply #20 on: February 07, 2006, 05:16:06 pm »

So, now index.php in /var/www/html/ displays ok with file owner and group either root or apache,
the problem was with CHMOD.
The alias I created works, but displays Forbidden again. I've tried setting /home/webmaster as CHMOD 777, file owner and group to apache and tried as root recursively but it doesn't affect it.
Logged

Rehuel Lobato de Mesquita

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
Logged
Stretsh Out...

Procrastination is like masturbation. You do it till you figure out you're only screwing yourself!

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
Apache again
« Reply #22 on: February 07, 2006, 06:23:45 pm »

Luka,
Can you try this?
Firts of all, erase your created 'alias'.
I think that the *usual* way to make this is:
(in the bottom of apache conf)
Code: [Select]

  <--- Local IP of the server
DocumentRoot /real/directory/of/your/project  <--- The *true* directory without final '/'
ServerName myproject  <-- could be any that you want (*)


(*) put this server name in the system file '/etc/host' like this:
1.1.1.1 [one tab] myproject

write it and restart your apache...
and open your browser and put the new name of your server http://myproject

I really hope this help!   :-[
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Español

Rod

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 78
    • http://www.rjs-custom.com
Apache again
« Reply #23 on: February 07, 2006, 11:17:25 pm »

hey Luka,

The way that I have this set up is as follows:

httpd.conf
Code: [Select]
DocumentRoot    /home/dobey/www/html
ScriptAlias          /cgi-bin/ /home/dobey/www/cgi-bin/

make sure that the folder has the right permissions

change folder permission
Code: [Select]
find /home/webmaster -type d -exec chmod 777 {} ;
change file permissions
Code: [Select]
find /home/webmaster -type f -exec chmod 666 {} ;
change ownership
Code: [Select]
chown -R webmaster.users /home/webmaster

Also I found that if you stop and start apache instead of restarting it, it usually works better for some reason in Fedora/Suse.

Now it should work if not, send me your httpd.conf file, and I could take a look at it and try to figure out where it might be causing you issues.

The entire rjs-custom.com domain is hosted from this folder that I have set-up under my home directory, with my users permissions.  Also if this works I'll send you a little bash script that sets the proper permissions for the folders under /home/webmaster everytime that you start/restart the computer, or you can set it up as a cron script to run periodically to set the proper permissions.

cheers
Logged
Whatever went wrong, I am pretty sure I didn't do it!  Well atleast I think I didn't do it...

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Apache again
« Reply #24 on: February 08, 2006, 10:00:35 am »

I've created alias that points to /home/1 and it works with CHMOD set to read only, and file owner is root.
The problem is probably with permissions inside the home directory.

Who has to have the permissions? Root, webmaster, users or apache?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Apache again
« Reply #25 on: February 08, 2006, 10:28:17 am »

Root ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

Rehuel Lobato de Mesquita

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
Apache again
« Reply #26 on: February 08, 2006, 04:00:04 pm »

assuming that your userid is webmaster:

With
Code: [Select]
ls -l /home/webmasteryou can see what user and group has the ownership of these files/directory. If it's root, ONLY root can access these files. If it's webmaster, then root AND webmaster can access them

/home should be owned by root.
/webmaster and all files and folders thereafter should be owned by webmaster (if that's your userid)

This is what Virtual host section looks like on my server:

Code: [Select]

ServerAlias www.example.com example.com
ServerAdmin webmaster@example.com
DocumentRoot /home/webmaster/public_html
BytesLog domlogs/exmaple.com-bytes_log

php_admin_value open_basedir "/home/webmaster/:/usr/lib/php:/usr/local/lib/php:/t$


php_admin_value open_basedir "/home/webmaster/:/usr/lib/php:/usr/local/lib/php:/t$


UserDir disabled
UserDir enabled webmaster

ServerName www.example.com
ScriptAlias /cgi-bin/ /home/webmaster/public_html/cgi-bin/
User webmaster
Group webmaster
CustomLog domlogs/example.com combined
Where example.com is the (sub)domain name you want to use here, and webmaster is the user, the group or the name of the userdir.
Logged
Stretsh Out...

Procrastination is like masturbation. You do it till you figure out you're only screwing yourself!
Pages: 1 [2]