How to use SSL-certificates to call https://localhost with apache2 on Raspberry Pi - apache

So I am currently working on a project where I use the Instagram API to get some user Data onto my Localhost webpage on the Raspberry. The API however needs secure redirect uri (https). But when the API wants do redirect to https://localhost/instagram it says
"404 Not Found The requested URL /instagram was not found on this server. Apache/2.4.25 (Raspbian) Server at localhost Port 443"
In the url-bar it says "Not secure", the https part is marked red and is crossed out. When I test my stuff on another computer which has Xampp and Apache running everything works fine and even if I type https://localhost it redirects straight to localhost.
I found out that I might need a SSL certificate in order to make use of https links even if I'm running on localhost. But I don't really know how I should do this on my raspberryPi. There are already some SSL modules enabled inside the Apache2 folder.

Related

How to enable HTTPS/SSL on XAMPP (Windows) using ngrok reverse proxy?

I am using ngrok to make my local instance of Apache (running through XAMPP on Windows 10) viewable to the internet. It works fine to access http://example.com but if I try https://example.com it gives me a certificate error (because the certificate is issued for its ngrok.io domain). I know I can avoid the cert error by using a url that ngrok generates for https, but I'd rather use my own domain name. How can I avoid the certificate error and get my site to load over https? I've seen a few guides for enabling https/ssl on localhost, but that's not what I need to do - I need to enable it for example.com, not localhost, and as I said, serving the site over http is working fine.

apache not serving index.html unless specified

Im new to setting up apache - the site works fine on localhost but when I access it from the LAN it does now display the index.html file - instead the browser says:
This site can’t be reached
localhost refused to connect.
Ive tried editing the apache2.conf file but nothing seems to work
I think you made another mistake. When you are on a different Computer on you network, the Apache server is not available on http://localhost/ but on the domain name or IP of the Apache Server.
The browser tries to open a connection to your client computer. But its not on localhost.

MAMP Pro, 403 forbidden unless typing https://

I have recently started switching all my sites to SSL, locally using Mamp Pro virtual hosts and self-sign certificates.
All works fine with one exception:
if I type local.domainname.co.uk in a browser I get a 403 error, unless I type the full https:// first, then it works fine. On the live site it all works as expected; type domainname.co.uk and the browser fills in the https:// for me.
These are drupal sites using htaccess module to force the ssl - but since it works live but not local I'm assuming its a mamp issue?
Solved this - I needed to set up a non-SSL host in MAMP with the same name and settings as the SSL host (with SSL unchecked obviously) - although I want the site all https, there still needs to be an http host so it can re-direct to ssl (until browsers default to https at some point in the future?). MAMP instructions.
Or don't bother if you can live with typing https:// every time!

xampp Apache enable proxy for interent operations

I have followd this answer https://serverfault.com/a/249582 to enable proxy and put a line to forward internet operations. However, since I use http://localhost to browse my website, it also redirected localhost to the proxy server and thus my website cannot even load.
How can I bypass local addresses such as localhost, 127.0.0.1 or internal network IP such as 192.168.1.50, such that fopensock can work normally?

Apache2 - going to https even when ssl is disabled

I have spent 1 full day on this and I am tired. Any help will be appreciated
Problem:
Rails app. Working perfectly on development machine. Deployed it on production machine - Ubuntu 10.04, Apache2 /2.2.14, mysql, Using Passenger for Rails.
Whenever I tried to access with serverName in the browser, the url will become https:// serverName and the page will not be displayed.
I ended up enabling ssl and generating a certificate. The site works with a warning - "not trusted. do you want to proceed". I am fine with that.
But I am trying to run it on http and nto redirect to https.
I disabled ssl mode with sudo a2dismod ssl
removed default-ssl from sites-enabled
Now ssl is disabled but still when I go to browser and type the server address or ip, it appends https to it and says 'This webpage is not available'
It is not the browser issue because I am able to access the other server (not owned by me) with http.
Also the app runs fine with http on my localhost in the same browser.
I would really appreciate if anyone could help me with disabling https completly on apache2.
I found out why the redirect was happening.
Everything was working fine on local but not in the production environment, even after disabling SSL on apache. It was rails which was redirecting it on https.
Had to do this
config.force_ssl = false
in config/environments/production.rb