By maltesepiero
Hi!! I activated 5$ plan vps yesterday, I’m quite impressed. I’m developing a management application, that have to run throught ssl. I created this virtualhost (following the guide on digital ocean): <VirtualHost *:443> ServerAdmin maltesepiero@gmail.com ServerName emmepiesse.no-ip.org:443 ServerAlias www.emmepiesse.no-ip.org:443
DirectoryIndex index.html
DocumentRoot /var/www/mps
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/mps/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
</VirtualHost>
and it works well, but I’ll have issue in redirecting http traffic. I tried with: <VirtualHost *:80> ServerName emmepiesse.no-ip.org Redirect / https://emmepiesse.no-ip.org:443 </VirtualHost> but no luck. Ideas? Thank you in advance
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The issue with the redirect is that you won’t be able to preserve for the REQUEST_URI so if a user goes to http://emmepiesse.no-ip.org/blog they will end up on https://emmepiesse.no-ip.org - as for why the redirect isn’t working you may want to update it to: <br> <br>Redirect permanent / https://emmepiesse.no-ip.org:443 <br> <br>Alternatively you can use .htaccess + mod_rewrite to setup a rewrite rule as follows which would redirect requests and also preserve the requested path/document: <br> <br>RewriteEngine On <br>RewriteCond %{HTTPS} off <br>RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} <br> <br>You can also replace HTTP_HOST with SERVER_HOST, HTTP_HOST refers to what the user provided in his URL when using his browser, while the SERVER_HOST refers to the Server Name that was defined in the config file for which the domain/IP matched in your configuration.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.