我的 Drupal 8 网站有一个 LAMP 服务器。
我想禁用 htaccess 文件以获得更好的服务器。
我遵循了以下教程:
https://www.vincentliefooghe.net/content/virtualhost-apache-pour-drupal
但是现在,当我加载我的网站页面时,会出现一个空白页,并显示以下消息:
handle($request); $response->send(); $kernel->terminate($request, $response);
我的服务器/etc/apache2/sites-available/www-domaine-com-le-ssl.conf
:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName domaine.com
ServerAlias www.domaine.com
Protocols h2 http/1.1
DocumentRoot /var/www/www-domaine-com/web/
<Directory /var/www/www-domaine-com/web>
Options FollowSymLinks MultiViews
AllowOverride None
Require all granted
Include /var/www/www-domaine-com/web/.htaccess
Include /var/www/www-domaine-com/web/sites/default/files/.htaccess
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>
<Proxy "fcgi://localhost/" enablereuse=on flushpackets=on max=10>
</Proxy>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/domaine.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domaine.com/privkey.pem
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Download-Options "noopen"
Header always set X-Permitted-Cross-Domain-Policies "none"
Header always set Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'; base-uri 'self';"
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
</VirtualHost>
</IfModule>
答案1
文件.htaccess
修改了它所在目录(以及该目录的任何子目录)中 apache web 服务器的行为。
在不知道两个单独的 .htaccess 文件的内容的情况下,我预计您需要两个目录块而不是单个目录块,因为第二个 .htaccess 不应该应用于 /var/www/www-domaine-com/web 的内容,并且您需要类似以下内容:
<Directory /var/www/www-domaine-com/web>
...
Include /var/www/www-domaine-com/web/.htaccess
</Directory>
<Directory /var/www/www-domaine-com/web/sites/default/files>
...
Include /var/www/www-domaine-com/web/.htaccess
Include /var/www/www-domaine-com/web/sites/default/files/.htaccess
</Directory>