RE: SSL and non-SSL same site
01-20-2016, 11:19 PM
(This post was last modified: 02-25-2016, 10:11 PM by jbeaumont.
Edit Reason: Fixed broken suhosin.executor.func.blacklist line.
)
(01-09-2016, 05:10 AM)gwolf2u Wrote: Hey there,
I would like to set my domain to be the same when I access it with http and https request.
I don't want to forward port 80.
So basically http://domain.tld and https://domain.tld should go to same page.
How can I do this?
Cheers,
Gabriel
I managed this by adding a listen 443 in /etc/apache2/apache.conf just above where the include for sentoras config is (might be httpd.conf instead of apache.conf for you.)
Then go into virtual host overrides setting, leave the override port blank and take a copy of the domain config from /etc/zpanel/config/apache/httpd-vhosts.conf and paste it into the text box. Change the port and add your ssl stuff. You will need to close the original virtualhosts statement at the top too. So for example something like this:
Code:
</virtualhost>
<virtualhost *:443>
ServerName example.com
ServerAlias www.example.com
ServerAdmin someone@email.com
DocumentRoot "/var/sentora/hostdata/username/public_html/example_com"
php_admin_value open_basedir "/var/sentora/hostdata/username/public_html/example_com:/var/sentora/temp/"
php_admin_value suhosin.executor.func.blacklist "passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, escapeshellarg, exec"
ErrorLog "/var/sentora/logs/domains/username/example.com-error.log"
CustomLog "/var/sentora/logs/domains/username/example.com-access.log" combined
CustomLog "/var/sentora/logs/domains/username/example.com-bandwidth.log" common
<Directory "/var/sentora/hostdata/username/public_html/example_com">
Options +FollowSymLinks -Indexes
AllowOverride All
Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 510 /_errorpages/510.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /data/sentora/hostdata/username/ssl_certs/www_example_com/www.example.com_ssl_certificate.cer
SSLCertificateKeyFile /data/sentora/hostdata/username/ssl_certs/www_example_com/www.example.com_private_key.key
SSLCertificateChainFile /data/sentora/hostdata/username/ssl_certs/www_example_com/www.example.com_ssl_certificate_INTERMEDIATE.cer
Adjust to your needs. Don't close of the virtualhost statement. Sentora will do that for you. Then wait for the daemon to run it's update.