Setting up apache to view https pages

11,425

A couple of things you can try:

  1. Since you're using <VirtualHost *:443> in /etc/apache2/sites-available/mysite.com, replace both instances of Listen 443 http with

    NameVirtualHost *:443
    Listen 443
    

    in your ports.conf.

  2. As far as I can tell, you are not using the default configurations to actually serve a website.

    If I'm right, disable them:

    a2dissite default default-ssl
    

    In this case, you should also delete the line

    ServerName localhost
    

    from your httpd.conf.

  3. Make sure your newest configuration and SSL are enabled.

    a2ensite mysite.com
    a2enmod ssl
    
  4. After making any changes, remember to reload apache to activate the new configuration:

    service apache2 reload
    
Share:
11,425

Related videos on Youtube

transcedentalia
Author by

transcedentalia

Updated on September 18, 2022

Comments

  • transcedentalia
    transcedentalia over 1 year

    I am trying to set up a site using vmware workstation, ubuntu 11.10, and apache2. The site works fine but now the https pages are not showing up. For example if I try to go to https://www.mysite.com/checkout I just see the message

    Not Found The requested URL /checkout/ was not found on this server.

    I dont really know what I am doing and have tried a lot of things to get the ssl certificates in there right.

    A few things I have in there, in my httpd.conf I just have :

    ServerName localhost

    In my ports.conf I have :

    NameVirtualHost *:80
    Listen 80
    
    <IfModule mod_ssl.c>
        # If you add NameVirtualHost *:443 here, you will also have to change
        # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
        # to <VirtualHost *:443>
        # Server Name Indication for SSL named virtual hosts is currently not
        # supported by MSIE on Windows XP.
        Listen 443 http
    </IfModule>
    
    <IfModule mod_gnutls.c>
        Listen 443 http
    </IfModule>
    

    In the /etc/apache2/sites-available/default-ssl :

    <IfModule mod_ssl.c>
    <VirtualHost _default_:443>
            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>
    
         .... truncated
    

    in the sites-available/default I have :

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            #DocumentRoot /home/magento/site/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
            #<Directory /home/magento/site/>
                    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 ${APACHE_LOG_DIR}/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        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 *:443>
      SSLEngine on
      SSLCertificateFile /etc/apache2/ssl/server.crt
            SSLCertificateKeyFile /etc/apache2/ssl/server.key
            ServerAdmin webmaster@localhost
      <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
            #<Directory /home/magento/site/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
    
    
            </Directory>
    
    </virtualhost>
    

    I also have in sites-availabe a file setup for my site url, www.mysite.com so in /etc/apache2/sites-available/mysite.com

    <VirtualHost *:80>
            ServerName mysite.com
            DocumentRoot /home/magento/mysite.com
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /home/magento/mysite.com/ >
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    
            ErrorLog /home/magento/logs/apache.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    </VirtualHost>
    <VirtualHost *:443>
            ServerName mysite.com
       DocumentRoot /home/magento/mysite.com
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /home/magento/mysite.com/ >
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    
            ErrorLog /home/magento/logs/apache.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    </VirtualHost>
    

    Thanks for any help getting this setup! As is probably obvious from this post I am pretty lost at this point.

    • m1k3y02
      m1k3y02 about 12 years
      can you open mysite.com/checkout on port 80 without any issues ?
    • transcedentalia
      transcedentalia about 12 years
      yes, i disabled the secure pages from the magento app I am running and the pages load fine.
  • transcedentalia
    transcedentalia almost 12 years
    Thanks, I followed everything but now I get a SSL connection error when I try to go to https:// Also when I restart apache2 I see errors like [warn] NameVirtualHost *:443 has no VirtualHosts
  • transcedentalia
    transcedentalia almost 12 years
    I am also seeing this error : VirtualHost *:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
  • Dennis
    Dennis almost 12 years
    Try removing the NameVirtualHost *:443 lines.
  • transcedentalia
    transcedentalia almost 12 years
    hmm i tried and it was still giving me those errors. I removed /conf.d/virtual.conf and error went away, but now I am back to a 404 on https pages
  • Dennis
    Dennis almost 12 years
    What do the log files say? Also, apache might not even be the culprit. This could have something to do with vmware.
  • transcedentalia
    transcedentalia almost 12 years
    ack.. hmm this sux. Logs no help... I dont think.. it does say client denied by server configuration (the local.xml of this magento install) but I dont think that is it