AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-519587

Zehke's questions

Martin Hope
Zehke
Asked: 2021-07-03 04:58:46 +0800 CST

2 个网站 www.example.com 和 www.example.eu 是否可以驻留在同一台服务器上

  • 0

我们有 2 个网站,并希望获得两者的 SSL 证书:

  1. www.example.de
  2. www.otherExample.eu

两个站点都位于具有自己配置文件的不同根目录下的同一台服务器上。使用 certbot,我为每个站点都获得了证书:sudo certbot --apache -d www.example.de -d www.otherExample.eu

www.example.de工作正常,但www.otherExample.eu抛出 SSL-NO-CIPHER-OVERLAP-Error 与此问题相关:How to fix SSL_ERROR_NO_CYPHER_OVERLAP for apache on apache with certbot

我知道握手发生在地址站点已知之前(这就是为什么我希望两个站点都拥有一个证书) 同一Apache服务器上的多个SSL网站

第一个问题:此时是否可以为两个站点获得一个证书?第二个问题:会不会因为两个站点的顶级域名不同而无法正常工作?

最后一个问题:通常是否有可能在一台服务器上运行两个受 SSL 保护的站点?

请注意:我们有一个 SNI 服务器,它首先获取请求并将其发送到网络服务器。

web-server ssl-certificate apache-2.4 certbot
  • 1 个回答
  • 64 Views
Martin Hope
Zehke
Asked: 2021-05-27 00:30:19 +0800 CST

错误重定向到 www.www2.example.de 的原因是什么

  • 0

我为我们的主要网站设置了一个测试服务器www.example.com。
我将 apache-sites-config 设置为www2.example.com.
我删除了.htaccess/ 调整它以保存基本的 wordpress 条目。
我禁用了浏览器的自动完成功能。

当我进入时,www2.example.com我被重定向并永久移动到www.www2.example.com.

当我进入时,192.168.0.1我被重定向到www.www2.example.com.

有人可以告诉错误可能在哪里吗?

.htaccess:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

sites-config for the first vHost:

<VirtualHost *:80>
     Protocols h2 http/1.1
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/
     ServerName www2.example.de
     ServerAlias www2.example.de

     <Directory /var/www/html>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


<VirtualHost *:443>
        ServerAdmin [email protected]
        Protocols h2 h2c http/1.1
        DocumentRoot /var/www/html/
        ServerName www2.example.de
        ServerAlias www2.example.de

        # added 01.04.2019 BEGINN
        <Directory /var/www/html>
                Options -Indexes +FollowSymLinks
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>
        # added 01.04.2019 END
        <Directory /var/www/html/>
          Options -Indexes +FollowSymlinks
          AllowOverride All
          Require all granted
         allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine off
</VirtualHost>
</IfModule>

sites-config for second vHost

<VirtualHost *:80>
     Protocols h2 http/1.1
     ServerAdmin [email protected]
     DocumentRoot /var/www/html1/example2/
     ServerName www2.example2.eu
     ServerAlias www2.example2.eu

     <Directory /var/www/html1/example2>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

The request- and response-header for www2.example.de

Connection:     Keep-Alive
Content-Length: 236
Content-Type:   text/html; charset=iso-8859-1
Date:           Wed, 26 May 2021 10:41:46 GMT
Expires:        Wed, 26 May 2021 10:42:46 GMT
Keep-Alive:     timeout=5, max=100
Location:       https://www.www2.example.de/
Server:         Apache


Accept:         text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:de,en-US;q=0.7,en;q=0.3
Cache-Control:  no-cache
Connection:     keep-alive
DNT:            1
Host:           www2.example.de
Pragma:         no-cache
Upgrade-Insecure-Requests:  1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
web-server .htaccess wordpress 301-redirect
  • 2 个回答
  • 73 Views
Martin Hope
Zehke
Asked: 2019-11-12 10:52:02 +0800 CST

400 Bad Request Rewriting HTTP to HTTPS not working

  • 0

我在 Debian 服务器上运行 apache 2.4.25。有一个网站可以通过:

example.de    and
www.example.de

它们应该通过 configs 和 .htaccess 重写为:

https://example.de
https://www.example.de

那是行不通的。

这些行由lets-encrypt添加到sites-enabled/000-default.conf中,我添加的注释行将example.de重写为www.example.de但它不起作用:

RewriteEngine on
# rewrite example.de to www.example.de changed 11.11.2019
#RewriteCond %{HTTP_HOST} ^example\.de$ [NC]
#RewriteRule (.*) https://www.example.de/$1 [R=301,L]
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301]
RewriteCond %{SERVER_NAME} =www.example.de
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 

SSL-config 写在 000-default-le-ssl.conf 中:

<IfModule mod_ssl.c>
<VirtualHost *:443>
...
    <Directory /var/www/>
            Options -Indexes +FollowSymLinks
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>
    # added 01.04.2019 END
    <Directory /var/www/html/>
      Options -Indexes +FollowSymlinks
      AllowOverride All
      Require all granted
      allow from all
    </Directory>
 ...
 SSLEngine on
 Include /etc/letsencrypt/options-ssl-apache.conf
 Header always set Content-Security-Policy upgrade-insecure-requests
 SSLCertificateFile /etc/letsencrypt/live/www.example.de/fullchain.pem
 SSLCertificateKeyFile /etc/letsencrypt/live/www.example.de/privkey.pem 

还有一个 wordpress.conf,其中包含端口 80 和 443 的虚拟主机条目,字面上包含 default 和 default-ssl.conf 的部分。

以下是用 .htaccess 编写的:

# BEGIN WordPress
<IfModule mod_rewrite.c> 
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# rewrite example.de to www.example.de changed 11.11.2019
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301]
#RewriteCond %{SERVER_PORT} !=443
#RewriteRule ^(.*)$ https://www.example.de/$1 [R=301,L]

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule îndex\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>     

我查看了错误日志中的重写条目:重写到 www 或 https 的重写规则不出现在那里(loglevel debug rewrite:trace4)。

当它只是一个从 http 重写为 https 的测试服务器时,它就像魅力一样工作,现在它的生活和它没有,而直接在浏览器中使用 https 工作(url 更改了一个字符和将 example.de 重写为 www 的条件。添加了 example.de)。我检查了模块;重新启动服务器;servername = www.example.de,serveralias = example.de;

我在 stackoverflow 上找到了这个,但没有任何效果或不适用于我的案例: https ://stackoverflow.com/questions/17853828/redirecting-http-to-https-with-apache

通过 http 服务端口 443 会创建 400 Bad Request Error 而不是重定向

有人可以帮忙吗?我没有解决它。提前致谢。

apache-2.4
  • 1 个回答
  • 632 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve