apache: http + https

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС для молодых и начинающих системных администраторов.

Модератор: SLEDopit

Ответить
Аватара пользователя
lgar
Сообщения: 117
ОС: Ubuntu

apache: http + https

Сообщение lgar »

Есть CMS Zen Cart, проблема в том, что админка работает только по HTTPS. Настроил кое-как Apache, теперь по http отображает:


Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.



Всё работает по https. Настраивал всё по https://help.ubuntu.com/6.10/ubuntu/serverg...e/ru/httpd.html.

CMS установил на субдомене: zencart.example.zone

Если есть возможность, то приведите, пожалуйста верный virtualhost. Как можно реализовать, чтобы отображался по HTTP/HTTPS?

P.S. У меня Ubuntu 8, добавил на основе default default-ssl, настройки виртуалхоста субдомена не трогал. Сейчас все субдомены работают только по https.
Как можно сделать так, чтобы 1 сайт работал по https, а лучше если его определенная директория, либо он работал по http/https?


Код: Выделить всё

/etc/apache2/sites-available# cat default-ssl
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost
SSLEngine on

SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key


        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /var/log/apache2/error.log

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

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
Спасибо сказали:
neol
Сообщения: 600
ОС: Debian Stable
Контактная информация:

Re: apache: http + https

Сообщение neol »

Код: Выделить всё

<VirtualHost *:443>
        ServerAdmin webmaster@localhost
SSLEngine on

SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key


        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /var/log/apache2/error.log

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

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /var/log/apache2/error.log

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

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

Как-то так. В общем это должны быть два разных VirtualHost на разных портах.
Спасибо сказали:
Аватара пользователя
lgar
Сообщения: 117
ОС: Ubuntu

Re: apache: http + https

Сообщение lgar »

Так я пробовал, возникала ошибка.

Надо было добавить:

NameVirtualHost *:80
NameVirtualHost *:443

Теперь всё субдомены отображают этот субдомен

NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
ServerName zen.domain.com
ServerAlias *.zen.domain.com

DocumentRoot /home/webmaster/www/zen

ScriptAlias /cgi/ "/home/webmaster/cgi/"
ScriptAlias /cgi-bin/ "/home/webmaster/cgi/"

ErrorLog /var/log/apache2/zen_errors.log
CustomLog /var/log/apache2/zen_custom.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName zen.domain.com
ServerAlias *.zen.domain.com

DocumentRoot /home/webmaster/www/zen
SSLEngine on

SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
ScriptAlias /cgi/ "/home/webmaster/cgi/"
ScriptAlias /cgi-bin/ "/home/webmaster/cgi/"

ErrorLog /var/log/apache2/zen_errors.log
CustomLog /var/log/apache2/zen_custom.log combined
</VirtualHost>
Спасибо сказали:
Аватара пользователя
lgar
Сообщения: 117
ОС: Ubuntu

Re: apache: http + https

Сообщение lgar »

Переформулирую, из-за чего может возникать такая ошибка:

[Mon Dec 27 18:47:07 2010] [error] VirtualHost *:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[Mon Dec 27 18:47:07 2010] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

Как от неё избавиться?
Спасибо сказали:
Аватара пользователя
sash-kan
Администратор
Сообщения: 13939
Статус: oel ngati kameie
ОС: GNU
Контактная информация:

Re: apache: http + https

Сообщение sash-kan »

lgar
где-то у вас в доступных файлах, видимо, имеется либо namevirtualhost либо virtualhost без указания порта.
Писать безграмотно - значит посягать на время людей, к которым мы адресуемся, а потому совершенно недопустимо в правильно организованном обществе. © Щерба Л. В., 1957
при сбоях форума см.блог
Спасибо сказали:
Ответить