Strona 1 z 1

[+] apache .htaccess

: 16 lipca 2019, 10:28
autor: noiro
apache nie widzi katalogów i plików w których jest plik .htaccess
w public_html mam kilka aplikacji w tym dokuwiki i wordpressa zainstalowały się bez problemu, za to katalogi drupal i grav (https://getgrav.org/) nie są nawet wyświetlane :( tylko w tych są pliki .htaccess więc myślę że tu może być problem. Jestem zielony w tych sprawach pomożecie to ugryźć?
Dodam że wszystko jest na lokalnym domowym komputerze.

Re: apache .htaccess

: 16 lipca 2019, 17:16
autor: Yampress
Należałoby wkleić tutaj zawartość tego pliku .htaccess
i cześć konfiguracji dotyczącej public_html z pliku konfiguracyjnego apache.
A drupal pewnie nie chodzi bo nie zainstalowałeś i nie zaladowales, tego co wymaga-> modułu rewrite do apache.

Re: apache .htaccess

: 16 lipca 2019, 20:09
autor: noiro
Rewrite jest chyba załadowany:

Kod: Zaznacz cały

ls /etc/apache2/mods-enabled/
access_compat.load  autoindex.load  mime.conf	      rewrite.load
alias.conf	    cgi.load	    mime.load	      setenvif.conf
alias.load	    deflate.conf    mpm_prefork.conf  setenvif.load
auth_basic.load     deflate.load    mpm_prefork.load  status.conf
authn_core.load     dir.conf	    negotiation.conf  status.load
authn_file.load     dir.load	    negotiation.load  userdir.conf
authz_core.load     env.load	    php7.3.conf       userdir.load
authz_host.load     fcgid.conf	    php7.3.load
authz_user.load     fcgid.load	    reqtimeout.conf
autoindex.conf	    filter.load     reqtimeout.load
tutaj jest plik .htaccess z grav

Kod: Zaznacz cały

<IfModule mod_rewrite.c>

RewriteEngine On

## Begin RewriteBase
# If you are getting 500 or 404 errors on subpages, you may have to uncomment the RewriteBase entry
# You should change the '/' to your appropriate subfolder. For example if you have
# your Grav install at the root of your site '/' should work, else it might be something
# along the lines of: RewriteBase /<your_sub_folder>
##

# RewriteBase /

## End - RewriteBase

## Begin - X-Forwarded-Proto
# In some hosted or load balanced environments, SSL negotiation happens upstream.
# In order for Grav to recognize the connection as secure, you need to uncomment
# the following lines.
#
# RewriteCond %{HTTP:X-Forwarded-Proto} https
# RewriteRule .* - [E=HTTPS:on]
#
## End - X-Forwarded-Proto

## Begin - Exploits
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Grav
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Exploits

## Begin - Index
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
## End - Index

## Begin - Security
# Block all direct access for these folders
RewriteRule ^(\.git|cache|bin|logs|backup|webserver-configs|tests)/(.*) error [F]
# Block access to specific file types for these system folders
RewriteRule ^(system|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
# Block access to specific file types for these user folders
RewriteRule ^(user)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
# Block all direct access to .md files:
RewriteRule \.md$ error [F]
# Block all direct access to files and folders beginning with a dot
RewriteRule (^|/)\.(?!well-known) - [F]
# Block access to specific files in the root folder
RewriteRule ^(LICENSE\.txt|composer\.lock|composer\.json|\.htaccess)$ error [F]
## End - Security

</IfModule>

# Begin - Prevent Browsing and Set Default Resources
Options -Indexes
DirectoryIndex index.php index.html index.htm
# End - Prevent Browsing and Set Default Resources
userdir.conf:

Kod: Zaznacz cały

<IfModule mod_userdir.c>
	UserDir public_html
	UserDir disabled root

	<Directory /home/*/public_html>
		AllowOverride FileInfo AuthConfig Limit Indexes
		Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
		Require method GET POST OPTIONS
	</Directory>
</IfModule>
Obrazek
https://ibb.co/zVFVCMw

error.log : https://paste.ofcode.org/3689Cv7BEYu8ypvVmx8HG82
access.log: https://paste.ofcode.org/x6J4uKinmPegcAzpLAZJQ

apache2.conf: https://paste.ofcode.org/jChCB5g8dhjYgJjYrXfVM9

Re: apache .htaccess

: 17 lipca 2019, 09:23
autor: LordRuthwen
Jak dla mnie to pluje się o Options w .htaccess

Re: apache .htaccess

: 17 lipca 2019, 18:53
autor: Yampress
wydaj polecenie

Kod: Zaznacz cały

apachectl -M
i dopiero sprawdz czy masz załaowany moduł 

rewrite_module

Re: apache .htaccess

: 17 lipca 2019, 20:03
autor: noiro
LordRuthwen pisze: 17 lipca 2019, 09:23 Jak dla mnie to pluje się o Options w .htaccess

Nie sadzę ponieważ tak samo reaguje na dowolny katalog z plikiem .htaccess

Kod: Zaznacz cały

root@debian:~# apachectl -M
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 fcgid_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)
 userdir_module (shared)
Plik .htaccess z drupal https://paste.ofcode.org/x2kjEGJTkQxC5k9NGy5GCW

Re: apache .htaccess

: 17 lipca 2019, 22:31
autor: noiro
Problem rozwiązany
Należy dodać do pliku /etc/apache2/apache2.conf:

Kod: Zaznacz cały

<Directory /home/*/public_html/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
I oczywiście service apache2 restart
Dzięki wszystkim za pomoc