We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Application over SSL is not working

Hello,

After fixing issue with setting up site at http I've got problem with setting site over SSL.

My configuration is following for *:80

Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/dev
    DirectoryIndex index.php index.html
    ServerName www.site.com
    ErrorLog logs/site.com-error_log
    CustomLog logs/site.com-access_log common

    <Directory /var/www/dev>
        RewriteEngine On
        RewriteOptions Inherit
        Options All
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

So I thought that if I copy it and add data needed for SSL it will work. However, when I do that I've got httpd default page. If I input in my address: https://site.com/public/index.php I can see that it's 'working there so it means that I'm in document root. So question is why with similar cofiguration for https as for http it's not working?

Listen 443
NameVirtualHost *:443
<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html
        DirectoryIndex index.php index.html
        ServerName www.site.com
        ErrorLog logs/site.com-error_log
        CustomLog logs/site.com-access_log common

        SSLCertificateKeyFile /path/to/key
        SSLCertificateFile /path/to/cert  
        SSLCACertificateFile /path/to/cert

        <Directory /var/www/html>
            RewriteEngine On
            RewriteOptions Inherit
            Options All
            AllowOverride FileInfo
            Order allow,deny
            Allow from all
        </Directory>

    </VirtualHost>
</IfModule>
edited Sep '15

This is an Apache configuration problem, not strictly related to Phalcon... it only works if served right.

but I see that you use /var/www/dev for the 80 and /var/www/html for the 443 conf

It;s also preferable to set the DocumentRoot to the public directory in your Phalcon project

It's different older since I use http for dev an https for production.