gpt4 book ai didi

apache - Webmin 登录不断循环到 session_login.cgi

转载 作者:行者123 更新时间:2023-12-02 11:36:06 28 4
gpt4 key购买 nike

我在 VPS 上设置了一个有效的 webmin,但是在尝试强制它通过 HTTPS 连接后,我在某个地方犯了错误,现在每当我尝试登录时,登录页面都无法正确显示(没有蓝色矩形)背景)并尝试通过 https://server1.domain.me:10000 登录,不断将我重定向到 https://server1.domain.me:10000/webmin/session_login.cgi,这又是一个登录页面。

在出现故障之前,我在 /etc/apache2/sites-available 中有以下文件

<VirtualHost *:80>
ServerAdmin webmaster@domain.me
ServerName domain.me
ServerAlias www.domain.me

DocumentRoot /var/www/domain.me/
<Directory />
RedirectMatch temp ^/$ /public_html
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/domain.me>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

<Directory /var/www/domain.me/redmine>
AllowOverride None
order allow,deny
allow from all
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature On

RailsEnv production
RailsBaseURI /redmine

</VirtualHost>

当我尝试强制 webmin(以及 owncloud,如果重要的话)使用 HTTPS 时,我使用 SSL key 为端口 443 创建了一个新的虚拟主机,并更新了端口 80 的虚拟主机以代理所有 http://domain.me/webminhttps://server1.domain.me:10000 (我保留了注释掉的配置供您查看我尝试过的内容):

<VirtualHost *:443>
ServerAdmin webmaster@domain.me
ServerName server1.domain.me
alias /owncloud /var/www/domain.me/owncloud

DocumentRoot /var/www/domain.me/

SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/ssl/ssl.crt/server1_domain_me.crt
SSLCertificateKeyFile /etc/ssl/ssl.crt/server1.key
SSLCACertificateFile /etc/ssl/ssl.crt/COMODORSADomainValidationSecureServerCA.crt

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

# <Location /webmin>
# RewriteEngine On
# #RewriteRule (.*) https://server1.domain.me:10000/$1 [R,L]
# ProxyPass https://server1.domain.me:10000/
# ProxyPassReverse https://server1.domain.me:10000/
# </Location>

<Directory /var/www/domain.me/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all

Satisfy Any

<IfModule mod_rewrite.c>
RewriteEngine on
<IfModule mod_ssl.c>
RewriteEngine On
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/owncloud$
</IfModule>
</IfModule>
</Directory>


# ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
# <Directory "/usr/lib/cgi-bin">
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
# </Directory>


ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature On

</VirtualHost>

并将我的domain.me虚拟主机文件更新为:

<VirtualHost *:80>
ServerAdmin webmaster@domain.me
ServerName domain.me
ServerAlias www.domain.me

#SSLEngine On
SSLProxyEngine On
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off

<Proxy *>
Order allow,deny
Allow from all
</Proxy>

DocumentRoot /var/www/domain.me/
<Directory />
RedirectMatch temp ^/$ /public_html
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/domain.me>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

<Directory /var/www/domain.me/redmine>
AllowOverride None
order allow,deny
allow from all
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>

<Location /owncloud>
ProxyPass https://server1.domain.me/owncloud/
</Location>

<Location /server1>
ProxyPass https://server1.domain.me/webmin/
</Location>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature On

RailsEnv production
RailsBaseURI /redmine


#ProxyPassReverse /owncloud https://server1.domain.me/owncloud/
#ProxyPassReverse /webmin https://server1.domain.me:10000/



</VirtualHost>

我还在 /etc/中添加了 webprefix=/webminwebprefixnoredir=1referer=domain.me 行webmin/config

但是,这里显然有问题,因为我根本无法登录 webmin。在过去的 5 个小时里,我一直在网上搜索答案,尝试了很多方法,但仍然没有成功。

有什么想法吗?

最佳答案

有 4 个关键的(且未记录的!) key 可以让这个工作,正如我在经历了很多烦恼之后发现的那样!

1) 编辑 /etc/webmin/config 时,请确保 webprefix=/webmin 行末尾没有空格。这将解决登录屏幕格式很奇怪的问题。

2) 您需要在 ProxyPass 中极其精确地使用斜线(并且它们与官方文档不符!)

ProxyPass /webmin/ http://localhost:10000/
ProxyPassReverse /webmin/ http://localhost:10000/

3) 您需要包含 cookie ProxyPass 行(同样不在文档中!)。

ProxyPassReverseCookieDomain /webmin/ http://localhost:10000/
ProxyPassReverseCookiePath /webmin/ http://localhost:10000/

4) 当您浏览 Webmin 时,必须包含尾部斜杠!

http://your.domain.name/webmin/

* 更新 *

关于第 4 点:

为了确保在浏览 Webmin 时始终存在尾部斜杠,请添加这些行(在您的代理通行证之前,如果重要的话?)。添加后,如果您忘记添加斜杠,Apache 会简单地为您完成:

RewriteEngine On                    
RewriteRule ^/webmin$ /webmin/ [R]

关于apache - Webmin 登录不断循环到 session_login.cgi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27581863/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com