PDA

Visualizza la versione completa : Virtualhost problematico


hope for us
17-02-2005, 10:45
Buongiorno a tutti, mi servirebbe 1 aiuto con Apache 2.0. Ho provato a utilizzare il virtual hosting name-based e ho creato 2 home page diverse a seconda dell'indirizzo da cui vengono raggiunte (tutto in locale, x esperimenti miei). I due percorsi delle home page sono rispettivamente quello di default (/var/www/html/index.html) raggiungibile da www.ecaricati.it e un'altra pagina (/home/stefano/sito_alternativo_apache/sito_alternativo.html) raggiungibile da www.alternativo.it.
Se metto nella barra degli indirizzi localhost, 127.0.0.1, 192.168.0.34, oppure www.ecaricati.it mi appare la home giusta ma se digito www.alternativo.it mi appare il msg "Forbidden You don't have permission to access / on this server. Additionally a 403 Forbidden Error was encountered while trying to use an ErrorDocument to handle the request".
Vi riporto sotto 1 stralcio di httpd.conf:



#
# Use name-based virtual hosting.
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost 192.168.0.34>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html
DirectoryIndex index.html
ServerName www.ecaricati.it
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
</VirtualHost>


<VirtualHost 192.168.0.34>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /home/stefano/sito_alternativo_apache
DirectoryIndex sito_alternativo.html
ServerName www.alternativo.it
ErrorLog /home/stefano/sito_alternativo_apache/error_log
CustomLog /home/stefano/sito_alternativo_apache/access_log common
<Directory /home/stefano/sito_alternativo_apache>
Options All Multiviews
AllowOverride All

Order allow,deny
Allow from 192.168.0.34
</Directory>

</VirtualHost>

Chi mi sa aiutare x favore? Grazie

DonFabio
17-02-2005, 10:48
I permessi della cartella? Mi sa che non la leggi per questo.
Esiste un index, o è un directory listening?

hope for us
17-02-2005, 10:52
Ma io in questo momento sono loggato come root, non dovrei poter fare qualsiasi cosa? Scusa l'ignoranza, sono abbastanza neofita per quanto riguarda apache... :cry:

DonFabio
17-02-2005, 10:54
Sì, ma se visiti le pagine col browser le visiti coi permessi di un qualunque guest all'host. :fagiano:

Prova a vedere i permessi della directory e, soprattutto, c'è un index? :fagiano:

hope for us
17-02-2005, 11:02
Allego altri estratti del file httpd.conf così ci capisci di più...



#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName localhost

#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# 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 "/var/www/html"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html/">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir disable

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
#UserDir public_html

</IfModule>

#
# 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>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

DonFabio
17-02-2005, 11:05
E che me ne faccio? :dottò:

Le mie domande di sopra sono in attesa di risposta. :fagiano:

hope for us
17-02-2005, 11:09
Scusa se sono 1 un pò rincoglionito, ma cosa intendi x c'è 1 index?Se intendi se esiste 1 file index.html sul 1primo dominio c'è mentre sul secondo si chiama sito_alternativo.html. X quanto riguarda i permessi questi 2 file hanno entrambi come permessi 644...
Spero di aver capito cosa volevi sapere... :oVVoVe:

DonFabio
17-02-2005, 11:32
Metti un index.htm su alternativo e vedrai, come per magia, il sito.

Altrimenti devi variare da qualche parte (ma non te lo consiglio) una direttiva sui file index.

L'errore, infatti, è il 403, che vuol dire mancanza di permessi.
Se non trova l'index.htm cerca di listare il contenuto della dir, ma siccome non ha i permessi in virtual host, da errore.

Metti un index.htm, casomai reindirizzalo alla prima pagina del sito che mi hai scritto.

Bye

Loading