Apache2 not rewriting as expected

I have a VPS on Digital ocean, hosting two websites, each with multiple domains.

Website 1: https://jeremiahrose.com/

Alternative domains: jeremiahro.se, jeremiahrose.band, www.jeremiahrose.com, www.jeremiahro.se, www.jeremiahrose.band

Website 2: https://thewilliewagtails.band/

Alternative domains: thewilliewagtails.com, thewilliewagtails.com.au, www.thewilliewagtails.band, www.thewilliewagtails.com, www.thewilliewagtails.com.au ,

Я пытаюсь настроить его так, чтобы запрос на любой из альтернативных доменов (http или https) перенаправлялся на безопасный канонический домен этого веб-сайта. например, www.thewilliewagtails.com перенаправляет на https://thewilliewagtails.band .

В настоящее время работает только наполовину - www.thewilliewagtails.com и thewilliewagtails.com возвращают страницу по умолчанию, а thewilliewagtails.band/ не перенаправляет.

Я не могу понять, в чем проблема, я ' m явно не для меня.

jez@jeremiahrose:/etc/apache2$ ls sites-enabled/
000-default.conf  jeremiahrose.com.conf  thewilliewagtails.band.conf

000-default.conf:

<VirtualHost *:80>
    ServerAdmin example@gmail.com
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

jeremiahrose.com.conf

<VirtualHost *:80>
        ServerAdmin example@gmail.com
        DocumentRoot /var/www/jeremiahrose.com

        <Directory /var/www/jeremiahrose.com/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

    ServerName jeremiahrose.com
        ServerAlias jeremiahro.se
        ServerAlias jeremiahrose.band
        ServerAlias www.jeremiahrose.com
        ServerAlias www.jeremiahro.se
        ServerAlias www.jeremiahrose.band


    RewriteEngine on
    #Added automatically by let's encrypt:
    RewriteCond %{SERVER_NAME} =www.jeremiahrose.com [OR]
    RewriteCond %{SERVER_NAME} =jeremiahrose.band [OR]
    RewriteCond %{SERVER_NAME} =www.jeremiahro.se [OR]
    RewriteCond %{SERVER_NAME} =jeremiahro.se [OR]
    RewriteCond %{SERVER_NAME} =jeremiahrose.com [OR]
    RewriteCond %{SERVER_NAME} =www.jeremiahrose.band
    RewriteRule ^ https://jeremiahrose.com%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin example@gmail.com
        DocumentRoot /var/www/jeremiahrose.com

        <Directory /var/www/jeremiahrose.com/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

    ServerName jeremiahrose.com
    ServerAlias jeremiahro.se
    ServerAlias jeremiahrose.band
    ServerAlias www.jeremiahrose.com
    ServerAlias www.jeremiahro.se
    ServerAlias www.jeremiahrose.band

    RewriteEngine on
        RewriteCond %{SERVER_NAME} =www.jeremiahrose.com [OR]
        RewriteCond %{SERVER_NAME} =jeremiahrose.band [OR]
        RewriteCond %{SERVER_NAME} =www.jeremiahro.se [OR]
        RewriteCond %{SERVER_NAME} =jeremiahro.se [OR]
        RewriteCond %{SERVER_NAME} =www.jeremiahrose.band
        RewriteRule ^ https://jeremiahrose.com%{REQUEST_URI} [END,NE,R=permanent]

    Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/jeremiahro.se/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/jeremiahro.se/privkey.pem
</VirtualHost>
</IfModule>

thewilliewagtails.band. Пока установка устаревшего BIOS работает. Когда я пытаюсь использовать EFI, это не удается. С dhcpd загрузка EFI работает. Поэтому ...

Я привязываю установить сервер установки PXE с dnsmasq в режиме proyxDHCP. Пока установка устаревшего BIOS работает. Когда я пытаюсь использовать EFI, это не удается.

С dhcpd загрузка EFI работает. Поэтому с файлом shim.efi все должно быть хорошо.

Unable to fetch TFTP image: Invalid Parameter
start_image() returned Invalid Parameter

Сообщение об ошибке изображения

[root@pxetestsrv tftpboot]# ll
total 2448
-rw-r--r-- 1 root root   20832 Apr  6 13:43 chain.c32
-rw-r--r-- 1 root root     175 Apr 10 09:47 grub.cfg
-rwxr-xr-x 1 root root 1024464 Apr  6 15:48 grubx64.efi
drwxr-xr-x 2 root root      39 Apr  9 09:48 images
-rw-r--r-- 1 root root   33756 Apr  6 13:43 mboot.c32
-rw-r--r-- 1 root root   26268 Apr  6 13:43 memdisk
-rw-r--r-- 1 root root   55140 Apr  6 13:43 menu.c32
-rw-r--r-- 1 root root   26826 Apr  6 13:43 pxelinux.0
drwxr-xr-x 2 root root      21 Apr  6 14:51 pxelinux.cfg
-rw-r--r-- 1 root root 1295704 Apr  6 15:48 shim.efi

proxydhcp.conf:

# Don't function as a DNS server:
port=0

# Log lots of extra information about DHCP transactions.
log-dhcp

# Set the root directory for files available via FTP.
enable-tftp
tftp-root=/var/lib/tftpboot

# PXE menu.  The first part is the text displayed to the user.  The second is the timeout, in seconds.
pxe-prompt="Booting PXE Client", 1

# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI, ARM_EFI and X86-64_EFI
# This option is first and will be the default if there is no input from the user.
# PXEClient:Arch:00000
 pxe-service=X86PC, "Boot BIOS PXE", pxelinux
# PXEClient:Arch:00007
 pxe-service=BC_EFI, "Boot UEFI PXE-BC", shim.efi
# PXEClient:Arch:00009
 pxe-service=X86-64_EFI, "Boot UEFI PXE-64", shim.efi
 dhcp-range=172.27.224.95,proxy

В журналах:

dnsmasq[30104]: started, version 2.76 DNS disabled
dnsmasq[30104]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify
dnsmasq-dhcp[30104]: DHCP, proxy on subnet 172.27.224.95
dnsmasq-tftp[30104]: TFTP root is /var/lib/tftpboot
dnsmasq-dhcp[30104]: 2149063664 available DHCP subnet: 172.27.224.95/255.255.255.0
dnsmasq-dhcp[30104]: 2149063664 vendor class: PXEClient:Arch:00009:????:??????
dnsmasq-dhcp[30104]: 2149063664 PXE(eth0) 00:50:56:b7:54:68 proxy
dnsmasq-dhcp[30104]: 2149063664 tags: eth0
dnsmasq-dhcp[30104]: 2149063664 next server: 172.27.224.95
dnsmasq-dhcp[30104]: 2149063664 broadcast response
dnsmasq-dhcp[30104]: 2149063664 sent size:  1 option: 53 message-type  2
dnsmasq-dhcp[30104]: 2149063664 sent size:  4 option: 54 server-identifier  172.27.224.95
dnsmasq-dhcp[30104]: 2149063664 sent size:  9 option: 60 vendor-class  00:ab:dc:33:23:23:23:23:23
dnsmasq-dhcp[30104]: 2149063664 sent size: 17 option: 97 client-machine-id  00:23:23:23:23:23:23:23:23:23:23:23:23:23...
dnsmasq-dhcp[30104]: 2149063664 available DHCP subnet: 172.27.224.95/255.255.255.0
dnsmasq-dhcp[30104]: 2149063664 vendor class: PXEClient:Arch:00009:????:??????
dnsmasq-dhcp[30104]: 180220542 available DHCP subnet: 172.27.224.95/255.255.255.0
dnsmasq-dhcp[30104]: 180220542 vendor class: PXEClient:Arch:00009:????:??????
dnsmasq-dhcp[30104]: 180220542 PXE(eth0) 00:50:56:b7:54:68 proxy
dnsmasq-dhcp[30104]: 180220542 tags: eth0
dnsmasq-dhcp[30104]: 180220542 bootfile name: shim.efi
dnsmasq-dhcp[30104]: 180220542 server name: 172.27.224.95
dnsmasq-dhcp[30104]: 180220542 next server: 172.27.224.95
dnsmasq-dhcp[30104]: 180220542 sent size:  1 option: 53 message-type  5
dnsmasq-dhcp[30104]: 180220542 sent size:  4 option: 54 server-identifier  172.27.224.95
dnsmasq-dhcp[30104]: 180220542 sent size:  9 option: 60 vendor-class  00:ab:dc:33:23:23:23:23:23
dnsmasq-dhcp[30104]: 180220542 sent size: 17 option: 97 client-machine-id  00:23:23:23:23:23:23:23:23:23:23:23:23:23...
dnsmasq-tftp[30104]: error 8 User aborted the transfer received from 172.27.224.251
dnsmasq-tftp[30104]: failed sending /var/lib/tftpboot/shim.efi to 172.27.224.251
dnsmasq-tftp[30104]: sent /var/lib/tftpboot/shim.efi to 172.27.224.251

0
задан 12 April 2018 в 10:27
1 ответ

Я столкнулся с той же проблемой и некоторое время занимался ее устранением. Прокладка и grub2 работают странным образом. Вы ДОЛЖНЫ иметь в качестве основного DHCP-сервера "следующий сервер", установленный для вашего proxyDHCP-сервера. Загрузка iPXE и ​​BIOS не имела значения, если у вас был прокси-сервер DHCP без установки следующего сервера, grub и прокладки, похоже, не работают без него.

0
ответ дан 5 December 2019 в 06:14

Теги

Похожие вопросы