尝试使用nginx设置BookStack失败后,我切换到了Apache。
但是,在设置子文件夹时也遇到类似的困难。
BookStack应该位于https://domain.name/bookstack。
BookStack的位置是/ var / www / bookstack/...。
我还在.env中添加了域。
我刚刚发现,HTTP的配置按预期工作。
<VirtualHost *:80>
ServerName domain.name
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# BookStack Configuration
Alias "/bookstack" "/var/www/bookstack/public"
<Directory "/var/www/bookstack/public">
Options FollowSymlinks
AllowOverride none
Require all granted
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
<Directory "/var/www/bookstack">
AllowOverride None
Require all denied
</Directory>
# End BookStack Configuration
</VirtualHost>
但是当我输入HTTPS的配置时(我使用certbot / letsencrypt创建了一个证书),我得到的登录页面没有样式。登录时,它带我到HTTP域,错误404未找到。
这是我当前的SSL配置:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName domainname
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# BookStack Configuration
Alias "/bookstack" "/var/www/bookstack/public"
<Directory "/var/www/bookstack/public">
Options FollowSymlinks
AllowOverride none
Require all granted
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
<Directory "/var/www/bookstack">
AllowOverride None
Require all denied
</Directory>
# End BookStack Configuration
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/certificate/key/file
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我没有这个问题。