HTTP trafic to HTTPS, cant get it to work

Discussion in 'Installation/Configuration' started by masterx, Jul 29, 2009.

  1. masterx

    masterx New Member

    I read that i can use mod_Rewrite... But im a newbie at PHP coding, so i don't know where to put it. I read that it should be in this file: /etc/apache2/sites-available/ispconfig.vhost.... But where in this file?

    The file looks like this:

    ######################################################
    # This virtual host contains the configuration
    # for the ISPConfig controlpanel
    ######################################################

    Listen 8080
    NameVirtualHost *:8080

    <VirtualHost _default_:8080>
    ServerAdmin webmaster@localhost

    <IfModule mod_fcgid.c>
    DocumentRoot /var/www/ispconfig/
    SuexecUserGroup ispconfig ispconfig
    <Directory /var/www/ispconfig/>
    Options Indexes FollowSymLinks MultiViews +ExecCGI
    AllowOverride AuthConfig Indexes Limit Options FileInfo
    AddHandler fcgid-script .php
    FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php

    RewriteEngine on
    RewriteCond %{SERVER_PORT} =80
    RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI}

    Order allow,deny
    Allow from all
    </Directory>
    </IfModule>

    <IfModule mod_php5.c>
    DocumentRoot /usr/local/ispconfig/interface/web/
    AddType application/x-httpd-php .php
    <Directory /usr/local/ispconfig/interface/web>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    php_value magic_quotes_gpc 0
    </Directory>
    </IfModule>

    <IfModule mod_ssl.c>
    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/server.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key
    </IfModule>

    # ErrorLog /var/log/apache2/error.log
    # CustomLog /var/log/apache2/access.log combined
    ServerSignature Off
    </VirtualHost>

    <Directory /var/www/php-cgi-scripts>
    AllowOverride None
    Order Deny,Allow
    Deny from all
    </Directory>

    <Directory /var/www/php-fcgi-scripts>
    AllowOverride None
    Order Deny,Allow
    Deny from all
    </Directory>

    But it still not works, anyone who can edit the file above, so it would work?

    Thanks in advance
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    What exactly do you want to do? This vhost is for the admin control panel on port 8080 only. As the admin controlpanel runs by default only without https, you can not redirect it to https as there is nothing to redirect it to. If you want to enable https for port 8080, take a look here:

    http://www.howtoforge.com/forums/showthread.php?t=27754
     
  3. masterx

    masterx New Member

  4. masterx

    masterx New Member

    Bump Bump...
     
  5. radim_h

    radim_h Member HowtoForge Supporter

    why not use default https port 443 ?

    Hello bumper .o)

    why not use ssl VirtualHost ?

    modify /etc/apache2/ports to looks like

    NameVirtualHost *:80
    Listen 80

    <IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    NameVirtualHost 123.456.789.012:443 (put your IP here)
    Listen 443
    </IfModule>


    then you modify /etc/apache2/sites-enabled/default-ssl as:

    <IfModule mod_ssl.c>
    #<VirtualHost _default_:443>
    #NameVirtualHost 123.456.789.012:443
    <VirtualHost 123.456.789.012:443> (put your IP here)

    then in /etc/apache2/sites-available create file as
    ispconfig.vhost.ssl
    (otherwise your .conf will be modified after ISPC update, correct me if i'm wrong..)

    and include original ISPC config vhost into this file, you can also redirect http for ISPC:

    <VirtualHost 123.456.789.012:80>
    ServerName ispc.yoursite.tld:80
    ServerAdmin [email protected]
    RewriteEngine on
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/(.*) https://ispc.yoursite.tld/$1 [L,R]
    </VirtualHost>


    <VirtualHost 123.456.789.012:443>
    SSLEngine on
    SSLCertificateFile /etc/ssl/_.yoursite.tld/_.yoursite.tld.crt
    SSLCertificateKeyFile /etc/ssl/_.yoursite.tld/_.yoursite.tld.key
    #<VirtualHost _default_:8080>
    ServerName ispc.yoursite.tld
    ServerAdmin [email protected]
    .
    .
    .
    .
    .
    .
    .
     

Share This Page