AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-1123691

Chlamy's questions

Martin Hope
Chlamy
Asked: 2024-08-18 22:42:31 +0800 CST

Redirecionamento Apache Vhost no subdomínio errado

  • 6

Eu tenho um problema com os vhosts do Apache. Solicitei o redirecionamento de HTTP para HTTPS (5001=http e 5002=https). O problema é que estou enfrentando um redirecionamento de um domínio para outro, mesmo nunca tendo definido essa regra.

Alguém poderia explicar por que isso está acontecendo?

Meus VHosts

<VirtualHost *:80>
    ServerName sub2.domain.com
    ServerAlias www.sub2.domain.com

    Redirect permanent / https://sub2.domain.com/
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/sub2_domain
    ServerName sub2.domain.com
    ServerAlias www.sub2.domain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/domain.crt
    SSLCertificateKeyFile /etc/ssl/private/domain.key

    <Directory /var/www/sub2_domain>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/domain_error.log
    CustomLog ${APACHE_LOG_DIR}/sub2_domain_access.log combined
</VirtualHost>

<VirtualHost *:5001>
    ServerName sub1.domain.com
    ServerAlias www.sub1.domain.com

        Redirect permanent / https://sub1.domain.com:5002/
</VirtualHost>

<VirtualHost *:5002>
    DocumentRoot /var/www/sub1_domain
    ServerName sub1.domain.com
    ServerAlias www.sub1.domain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/domain.crt
    SSLCertificateKeyFile /etc/ssl/private/domain.key

    <Directory /var/www/sub1_domain>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require ip 192.168.1.0/24
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/domain_error.log
    CustomLog ${APACHE_LOG_DIR}/sub1_domain_access.log combined
</VirtualHost>

Exibição do Apache

VirtualHost configuration:
*:5001                 sub1.domain.com (/etc/apache2/sites-enabled/sub1_domain.conf:1)
*:5002                 sub1.domain.com (/etc/apache2/sites-enabled/sub1_domain.conf:8)
*:80                   sub2.domain.com (/etc/apache2/sites-enabled/sub2_domain.conf:1)
*:443                  sub2.domain.com (/etc/apache2/sites-enabled/sub2_domain.conf:8)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex fcgid-proctbl: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex fcgid-pipe: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

Minha solicitação cUrl

C:\Users\user>curl -sv -o nul sub1.domain.com
* Host sub1.domain.com:80 was resolved.
* IPv6: (none)
* IPv4: 192.168.1.201
*   Trying 192.168.1.201:80...
* Connected to sub1.domain.com (192.168.1.201) port 80
> GET / HTTP/1.1
> Host: sub1.domain.com
> User-Agent: curl/8.7.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Sat, 17 Aug 2024 19:31:10 GMT
< Server: Apache/2.4.61 (Debian)
< Location: https://sub2.domain.com/
< Content-Length: 328
< Content-Type: text/html; charset=iso-8859-1
<
{ [328 bytes data]
* Request completely sent off
* Connection #0 to host sub1.domain.com left intact

Obrigado

apache-2.4
  • 1 respostas
  • 35 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

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

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve