Hi all, I have a problem with php not working with ssl. I followed the Perfect Server setup for opensuse 10.3 and installed ispconfig Version: 2.2.21. This is a very nice tutorial, very well done. I have SSL working for html files, no errors, but it won't work for php. When requesting php files through HTTPS, the php is not executed and the server sends the php file to the client and php code is displayed in the browser. So, http://somedomain/index.html works ok, https://somedomain/index.html works ok, http://somedomain/index.php works ok, https://somedomain/index.php does not work. I have double checked the settings in ispconfig. I have double checked the settings for the Perfect Server opensuse 10.3. I tried a home made ssl certificate. I am now using a single site certificate from Comodo. I am not trying to share the certificate with other domains. The SSL port is 443. I do not have more than one virtual host on this port. I have tried quite a few modifications to the various config files. I can find no errors in the log files. At this point I'm stumped.
Thank you for your reply. The only error I can find is in the /var/log/apache2/error_log when I restart apache: [Wed Oct 22 09:22:29 2008] [notice] caught SIGTERM, shutting down [Wed Oct 22 09:22:29 2008] [warn] (22)Invalid argument: Failed to destroy the '/tmp/mod_mono_dashboard_XXGLOBAL_1' shared memory dashboard [Wed Oct 22 09:22:30 2008] [warn] RSA server certificate CommonName (CN) `D' does NOT match server name!? [Wed Oct 22 09:22:30 2008] [warn] RSA server certificate CommonName (CN) `bestamericagifts.com' does NOT match server name!? [Wed Oct 22 09:22:30 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2) [Wed Oct 22 09:22:30 2008] [warn] RSA server certificate CommonName (CN) `D' does NOT match server name!? [Wed Oct 22 09:22:30 2008] [warn] RSA server certificate CommonName (CN) `bestamericagifts.com' does NOT match server name!? [Wed Oct 22 09:22:31 2008] [notice] Apache/2.2.4 (Linux/SUSE) mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.6 with Suhosin-Patch mod_mono/1.2.5 configured -- resuming normal operations The certificate still works and gives me the golden padlock. These are my test urls. http://bestamericagifts.com/test/index.html http://bestamericagifts.com/test/index.php https://bestamericagifts.com/test/index.html https://bestamericagifts.com/test/index.php They all work except for the last one. Is it possible that the above error could cause php not to work for SSL? Here is the conf file you requested. ################################### # # ISPConfig vHost Configuration File # Version 1.0 # ################################### # NameVirtualHost 192.168.1.10:80 <VirtualHost 192.168.1.10:80> ServerName localhost ServerAdmin root@localhost DocumentRoot /var/www/sharedip </VirtualHost> # # ###################################### # Vhost: www.yaasuo.com:80 ###################################### # # <VirtualHost 192.168.1.10:80> ServerName www.yaasuo.com:80 ServerAdmin [email protected] DocumentRoot /srv/www/web1/web ServerAlias yaasuo.com DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm Alias /cgi-bin/ /srv/www/web1/cgi-bin/ AddHandler cgi-script .cgi AddHandler cgi-script .pl ErrorLog /srv/www/web1/log/error.log AddType application/x-httpd-php .php .php3 .php4 .php5 php_admin_flag safe_mode Off <IfModule mod_ruby.c> <Directory /srv/www/web1/web> Options +ExecCGI </Directory> RubyRequire apache/ruby-run #RubySafeLevel 0 <Files *.rb> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> <Files *.rbx> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> </IfModule> AddType text/html .shtml AddOutputFilter INCLUDES .shtml Alias /error/ "/srv/www/web1/web/error/" ErrorDocument 400 /error/invalidSyntax.html ErrorDocument 401 /error/authorizationRequired.html ErrorDocument 403 /error/forbidden.html ErrorDocument 404 /error/fileNotFound.html ErrorDocument 405 /error/methodNotAllowed.html ErrorDocument 500 /error/internalServerError.html ErrorDocument 503 /error/overloaded.html AliasMatch ^/~([^/]+)(/(.*))? /srv/www/web1/user/$1/web/$3 AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web1/user/$1/web/$3 </VirtualHost> # # # ###################################### # Vhost: www.bestamericagifts.com:80 ###################################### # # <VirtualHost 192.168.1.10:80> ServerName www.bestamericagifts.com:80 ServerAdmin [email protected] DocumentRoot /srv/www/web2/web ServerAlias bestamericagifts.com DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm Alias /cgi-bin/ /srv/www/web2/cgi-bin/ AddHandler cgi-script .cgi AddHandler cgi-script .pl ErrorLog /srv/www/web2/log/error.log AddType application/x-httpd-php .php .php3 .php4 .php5 php_admin_flag safe_mode Off <IfModule mod_ruby.c> <Directory /srv/www/web2/web> Options +ExecCGI </Directory> RubyRequire apache/ruby-run #RubySafeLevel 0 <Files *.rb> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> <Files *.rbx> SetHandler ruby-object RubyHandler Apache::RubyRun.instance </Files> </IfModule> AddType text/html .shtml AddOutputFilter INCLUDES .shtml AddType application/vnd.wap.wmlscriptc .wmlsc .wsc AddType text/vnd.wap.wml .wml AddType text/vnd.wap.wmlscript .ws .wmlscript AddType image/vnd.wap.wbmp .wbmp Alias /error/ "/srv/www/web2/web/error/" ErrorDocument 400 /error/invalidSyntax.html ErrorDocument 401 /error/authorizationRequired.html ErrorDocument 403 /error/forbidden.html ErrorDocument 404 /error/fileNotFound.html ErrorDocument 405 /error/methodNotAllowed.html ErrorDocument 500 /error/internalServerError.html ErrorDocument 503 /error/overloaded.html AliasMatch ^/~([^/]+)(/(.*))? /srv/www/web2/user/$1/web/$3 AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web2/user/$1/web/$3 </VirtualHost> # # #
Yes, that is all that is in Vhosts_ispconfig.conf. There is an ssl vhost in /etc/apache2/vhosts.d/bestamericagifts.conf, here is that file: # Template for a VirtualHost with SSL # Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf. # Files must have the .conf suffix to be loaded. # # See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints # about virtual hosts. # NameVirtualHost statements should be added to /etc/apache2/listen.conf. # # This is the Apache server configuration file providing SSL support. # It contains the configuration directives to instruct the server how to # serve pages over an https connection. For detailing information about these # directives see <URL:http://httpd.apache.org/docs-2.2/mod/mod_ssl.html> # # For the moment, see <URL:http://www.modssl.org/docs/> for this info. # The documents are still being prepared from material donated by the # modssl project. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Until documentation is completed, please check http://www.modssl.org/ # for additional config examples and module docmentation. Directives # and features of mod_ssl are largely unchanged from the mod_ssl project # for Apache 1.3. <IfDefine SSL> <IfDefine !NOSSL> ## ## SSL Virtual Host Context ## <VirtualHost 192.168.1.10:443> # General setup for the virtual host DocumentRoot "/srv/www/web2/web" ServerName bestamericagifts.com:443 ServerAdmin [email protected] ErrorLog /var/log/apache2/error_log TransferLog /var/log/apache2/access_log # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # SSL Cipher Suite: # List the ciphers that the client is permitted to negotiate. # See the mod_ssl documentation for a complete list. SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL # Server Certificate: # Point SSLCertificateFile at a PEM encoded certificate. If # the certificate is encrypted, then you will be prompted for a # pass phrase. Note that a kill -HUP will prompt again. Keep # in mind that if you have both an RSA and a DSA certificate you # can configure both in parallel (to also allow the use of DSA # ciphers, etc.) SSLCertificateFile /etc/apache2/ssl.crt/bestamericagifts_com.crt #SSLCertificateFile /etc/apache2/ssl.crt/server-dsa.crt # Server Private Key: # If the key is not combined with the certificate, use this # directive to point at the key file. Keep in mind that if # you've both a RSA and a DSA private key you can configure # both in parallel (to also allow the use of DSA ciphers, etc.) SSLCertificateKeyFile /etc/apache2/ssl.key/bestamericagifts.key #SSLCertificateKeyFile /etc/apache2/ssl.key/server-dsa.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/apache2/ssl.crt #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # Access Control: # With SSLRequire you can do per-directory access control based # on arbitrary complex boolean expressions containing server # variable checks and other lookup directives. The syntax is a # mixture between C and Perl. See the mod_ssl documentation # for more details. #<Location /> #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ #</Location> # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o CompatEnvVars: # This exports obsolete environment variables for backward compatibility # to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this # to provide compatibility to existing CGI scripts. # o StrictRequire: # This denies access when "SSLRequireSSL" or "SSLRequire" applied even # under a "Satisfy any" situation, i.e. when it applies access is denied # and no other module can change it. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> <Directory "/srv/www/cgi-bin"> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # Per-Server Logging: # The home of a custom SSL log file. Use this when you want a # compact non-error SSL logfile on a virtual host basis. CustomLog /var/log/apache2/ssl_request_log ssl_combined </VirtualHost> </IfDefine> </IfDefine> Also, here is the output from httpd2: httpd2 -S -DSSL VirtualHost configuration: 192.168.1.10:80 is a NameVirtualHost default server localhost (/etc/apache2/vhosts/Vhosts_ispconfig.conf:9) port 80 namevhost localhost (/etc/apache2/vhosts/Vhosts_ispconfig.conf:9) port 80 namevhost www.yaasuo.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:21) port 80 namevhost www.bestamericagifts.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:69) 192.168.1.10:443 bestamericagifts.com (/etc/apache2/vhosts.d/bestamericagifts.conf:37) 192.168.1.10:444 yaasuo.com (/etc/apache2/vhosts.d/yaasuo.conf:37) I made some changes to the bestamericagifts.conf file and fixed the previous warning on apache startup: [warn] RSA server certificate CommonName (CN) `bestamericagifts.com' does NOT match server name!? I no longer get this warning on startup.
You must create the SSL vhost in ISPConfig. Please enable SSL for www.bestamericagifts.com and go to the SSL tab and create a certificate.
I tried that twice, didn't work. After I tried it, I checked to see which files had been modified like this: find / -name "*.conf" -mmin -120 -print /etc/proftpd_ispconfig.conf /etc/apache2/httpd.conf /etc/apache2/sysconfig.d/global.conf /etc/apache2/sysconfig.d/loadmodule.conf /etc/apache2/sysconfig.d/include.conf /etc/apache2/vhosts/Vhosts_ispconfig.conf Then I opened each file and I couldn't see any changes that had anything to do with ssl. I was also surprised that no modifications were made in the /etc/apache2/vhosts.d directory. I also ran debug output on the ssl log and didn't see anything that looked like a problem.
After making the suggested changes in ispconfig, I did notice that the following files were created in: /srv/www/web2/ssl/ www.bestamericagifts.com.crt www.bestamericagifts.com.csr www.bestamericagifts.com.key www.bestamericagifts.com.key.org I checked the file: /etc/apache2/vhosts.d/bestamericagifts.conf and it had not been modified to point at the above files. I made the changes manually, but php still does not work.
ls -la /etc/apache2/vhosts* /etc/apache2/vhosts: total 24 drwxr-xr-x 2 root root 4096 2008-10-25 11:15 . drwxr-xr-x 11 root root 4096 2008-10-25 11:18 .. -rw-r--r-- 1 root root 5393 2008-10-25 21:10 Vhosts_ispconfig.conf -rw-r--r-- 1 root root 3526 2008-10-25 21:10 Vhosts_ispconfig.conf~ -rw-r--r-- 1 root root 1646 2008-04-10 19:53 Vhosts_ispconfig.conf_10-04-08_19-53-30 /etc/apache2/vhosts.d: total 88 drwxr-xr-x 2 root root 4096 2008-10-25 22:59 . drwxr-xr-x 11 root root 4096 2008-10-25 11:18 .. -rw-r--r-- 1 root root 9419 2008-10-25 22:59 bestamericagifts.conf -rw-r--r-- 1 root root 9249 2008-10-24 15:21 bestamericagifts.old -rw-r--r-- 1 root root 9279 2008-10-25 10:35 bestamericagifts.old2 -rw-r--r-- 1 root root 9222 2008-03-26 07:42 vhost-ssl.template -rw-r--r-- 1 root root 4310 2008-03-26 07:42 vhost.template -rw-r--r-- 1 root root 9222 2008-06-12 14:27 yaasuo.conf~ -rw-r--r-- 1 root root 9241 2008-10-24 15:52 yaasuo.old
I have done a lot of research on the Internet on this problem and I don't see other people having this problem. I am convinced that I have done something to cause this. I am looking at what could be different on my server and a fresh install of The Perfect Server Opensuse 10.3. Here is what I have so far: I have installed: chkrootkit snort fail2ban KDE various development IDEs In my network services, these are the additional things that are there now, but were not in a fresh install: DHCP server DNS server DNS and host name NIS server Routing SLP server iSCSI target Also, I have installed a lot of patches to various things, just whatever was recommended when I checked for updates. Most likely, something I have installed, updated or enabled has over written files, changed configurations and/or is not compatible with php, ssl and/or ispconfig.
What's in Vhosts_ispconfig.conf now? That's the only file that should hold your vhosts, you don't need the vhosts in /etc/apache2/vhosts.d.
It works!!! Thanks for all your help. There is now an SSL vhost in Vhosts_ispconfig.conf. I got rid of this file: /etc/apache2/vhosts.d/bestamericagifts.conf and it started working.