Autor Zpráva
vlado123
Profil
Dobrý deň,

mám problém s nastavením virtual hostu na apche na localhoste.

v httpd.conf mám takéto nastavenie adresára:

<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 MultiViews
Options Indexes FollowSymLinks ExecCGI Includes

#
# 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 Indexes

AllowOverride All

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

</Directory>

s tým problém nie je direktívy v .htaccess sa normálne vykonajú, problém nastane vtedy ak použijem toto isté nastavenie pre virtual host napr.

NameVirtualHost 127.0.100.1:80
<VirtualHost 127.0.100.1:80>
ServerName korma
ServerAdmin admin@korma
DocumentRoot /var/www/weby/korma/html
# Setenv VLOG /var/www/weby/korma/logs/log
# ErrorLogs /var/www/weby/korma/logs/error_log
<Directory />
#Options -All -Multiviews
#AllowOverride None
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

<Directory "/var/www/weby/korma/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 MultiViews
Options -Indexes FollowSymLinks ExecCGI Includes
#
# 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 Indexes

AllowOverride All

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

</Directory>

<IfModule mod_dir.c>
DirectoryIndex index.html index.html.var index.cgi index.pl index.htm Default.htm default.htm index.xml index.php
</IfModule>

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>


</VirtualHost>

Tak pri zapnutej direktíve AllowOverride All sa mi zobrazí chybová stránka 403 prístup zamietnutý, ak je na none tak sa vykoná správne.

v .htaccess je nasledovný:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php )?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.


# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine On

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
#RewriteBase /
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81.2.4 2008/01/22 09:01:39 drumm Exp $

Zaujímavé je to že žiadne direktívy sa nevkonajú ale po zadaní neexistujúcej adrese sa zobrazí nastavená chybová stránka pomocou .htaccess .

Mám Apache 2.2.6
vlado123
Profil
Na problém som už prišiel je potrebné zemniť nastavenie pre adresáre a to z:

<Directory />
Options FollowSymLinks
AllowOverride All na AllowOverride AuthConfig
Order deny,allow
Deny from all
</Directory>

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0