Can't access https version of WAMP site outside localhost - apache

After setting up SSL on my 64-bit WAMP server on Windows 7, I tried to access the https version of the site. However, I get this error: ERR_SSL_PROTOCOL_ERROR
I've port forwarded, shut down my firewall, and made sure my certificate and key is valid (bought from a verified CA). Even if they weren't, Chrome would still provide a warning asking me if it's okay to proceed. Accessing the http version of the website works.
I tried accessing the same website from another computer on my network using its local IP and no luck. Same error. However, when I type https://mypublicdomain.com on the same PC I'm hosting the site from, it loads fine without any warnings from Chrome, says "Connection is secure." Same thing with https://localhost, it just warns me before visiting the website.
I've tried making a new <VirtualHost *:443> block in httpd-vhosts.conf with Require all granted, however it still seems to give the error on remote PCs trying to access the site on or off my network from my domain.
Any help would be greatly appreciated, thanks.
Apache version 2.4.23

I just figured it out. I had another <VirtualHost ...> block configured to the 443 port in my httpd-vhosts.conf that was causing the 443 port to not run under SSL at all becasue it did not have SSLEngine on in it. After deleting that block in that file, just leaving the port 80 one, it seems to be working. I also had to make sure that NameVirtualHost *:443 was directly above <VirtualHost _default_:443> in my httpd-ssl.conf file or else the whole setup would not work.

Related

MAMP Virtual Hosts not working properly, loading 'It Works!' page

I had an issue last night where MAMP just refused to connect to the Apache server(unsure whether this has something to do with my issue). I decided to uninstall and reinstall. I was able to connect once again, however, when I added my virtual host to the httpd-vhosts.conf file in my MAMP folder, and navigate to it I get brought to a 'It works!' page. (I also realised I get this page by typing localhost even without running MAMP?)
Below are some of my files
httpd.conf(in MAMP)
//Uncommented line below
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
httpd.conf(in MAMP)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName portfolio
DocumentRoot '/Applications/MAMP/htdocs/portfolio'
</VirtualHost>
<VirtualHost *:80>
DocumentRoot '/Applications/MAMP/htdocs'
ServerName localhost
</VirtualHost>
/private/etc/hosts
##
# Host Database
# localhost is used to configure the lookback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 portfolio
This is a copy paste of what I had before which worked 100%, unsure what happened between MAMP stopping working, the uninstall and reinstall. Is there an issue with apache somehow overwriting something? Really out of my depth here with this issue. Is there somewhere else I should be looking to debug this?
For reference, localhost:8888 & localhost:8888/portfolio work as expected, localhost/ & portfolio/ don't, brings me to the 'It works!' page. Before this issue I was able to do 'localhost/phpmyadmin' to bring me to phpmyadmin and 'localhost/portfolio' to bring me to that directory, but neither of those work either. I've been wracking me brain for hours over this, watching tutorials and reading other answers but to no avail.
Anyone have any idea why this is occuring? Any help would be greatly appreciated.
So I eventually figured it out if anyone else has the same issue. I had forgotten previously that I had my localhost running on port 80. However when I tried that before my apache server wouldn't start on MAMP, the reason being was due to port 80 being used by /private/etc/apache2, so I used the answer to this question
https://superuser.com/questions/986775/how-can-i-remove-apache2-that-i-have-installed-in-mac-os-x
to remove apache. (Alternatively I guess you could just change the port number it listens to in the httpd.conf files?) I then changed my MAMP to listen to port 80 and this fixed my problem. Hope this helps anyone else with same issue

How to enable Apache SSL Reverse Proxy on HTTP application

I've been having problems attempting to implement a reverse SSL proxy on Apache for an HTTP application on Ubuntu 14.04. As a baseline, the application works fine when I access it via port 8000 in the browser normally. For all intents and purposes, let's say the IP of my app is 192.141.56.11 (I do not have a domain name yet). The application runs with HTTP Basic Auth, I don't know if it's relevant. Basically I'm fishing for some glaring error here and would be grateful if you could help me out. Here is a log of my process:
I created my SSL cert and key and put them in the following locations:
/etc/apache/ssl/apache.crt (I performed chmod 644 here)
/etc/apache/ssl/apache.key (I performed chmod 400 here)
I then installed:
apt-get install apache2
a2enmod proxy
a2enmod ssl
a2enmod proxy_http
I then disabled the default config with:
a2dissite 000-default
I created the file "/etc/apache2/sites-available/redirect.conf"
I then created the file "/etc/apache2/sites-available/redirect.conf" and copied the text below:
<VirtualHost *:80>
Redirect "/" "https://192.141.56.11"
</VirtualHost>
After, I created the file "/etc/apache2/sites-available/reverse_proxy.conf" and copied below:
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache/ssl/apache.crt
SSLCertificateKeyFile /etc/apache/ssl/apache.key
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
and did:
service apache2 restart
I now attempt to access the UI of the application on another machine in the Chrome browser. When trying:
https://192.141.56.11
I get a general SSL connection error.
However, trying
http://192.141.56.11:8000
gives me the application, as if none of my config changed anything. However,
192.141.56.11:80
gives me an "Index Of" page with an html folder that says "Apache/2.4.7 (Ubuntu) Server at 192.141.56.11 Port 80"
192.141.56.11:443
gives me the same result except with "Apache/2.4.7 (Ubuntu) Server at 192.141.56.11 Port 443"
I've tried all manners of configurations but can't get what I want -- any ideas here?
EDIT: I tried https[:]//192.141.56.11 and got a more specific SSL error:
received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
EDIT2: After running apache, I get this warning;
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
I suppose this is fine as I am using an IP and not a domain name.
EDIT3: It turns out I needed to do:
a2ensite reverse_proxy.conf.
Now https[:]//192.141.56.11 works but defaults to an apache page. working on this.
EDIT4: I had to do
a2dissite default-ssl.conf
Now It actually redirects to the app on https[:]//192.141.56.11!! But I can still access the app via port 8000, which is bad {still working on}
EDIT5: IN the end, I couldn't figure out how to block access to the original app via port 8000 on Apache. Instead, I just implemented iptables on the server so that it can only be accessed via HTTPS. This is probably not the correct method. but all I could think of.

Apache fresh installation ssl

I've installed Apache on CentOS and have not enabled SSL, and yet I get the following error.
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please. Hint:
https://192.168.1.50/ Apache/2.2.15 (CentOS) Server at 192.168.1.50
Port 443
The page I was testing it is a simple html page.
I did not make many changes to the fleshly installed Apache. The only things I edited are IPTABLES config file to allow LAN access on port 80 and the httpd.conf file to change document root.
I've installed Apache before(on Fedora), but didn't have this problem.
Thank you.
I managed to find the problem. I found a sll.conf file that contains all of the SSL configuration lines. The SSL was enabled by default, its weird. It is located in /etc/httpd/conf.d/ and a simple
<VirtualHost _default_:443>
SSLEngine off
</VirtualHost>
did the trick.

Specific Port Configuration on Apache

So I'm trying to develop a php website locally on my macbook. I'm using apache as my webserver, I have php and mysql installed, and I can use the php index file in my sites folder, but I would like to move all of my development over to a different.
I've been trying to configure apache to run on a different port, so far I've made these changes to my /etc/apache2/extras/httpd-vhost.conf
<VirtualHost *:2727>
ServerAdmin foobar#gmail.com
DocumentRoot "/Users/brianWheeler/Foobar"
ServerName local.foobar.com
</VirtualHost>
And i've edited my /etc/apache2/httpd.conf to say
listen 127.0.0.1:2727 http
I've started apache, but when I go to 127.0.0.1:2727 I get the google chrome page not found type thing.
I've run apachectl -t command to see whats wrong, and I just get this one error
httpd: Could not reliably determine the server's fully qualified domain name, using Foo-Bars-MacBook.local for ServerName
So my questions are, how do I configure the DocumentRoot/index page, and what kind of diagnostics can I run to see why this won't work?
-Brian
httpd: Could not reliably determine the server's fully qualified domain name, using Foo-Bars-MacBook.local for ServerName - this error possibly is not related with your problem.
most of my test server are giving this error but they are running with no problem.
please try to insert the line without ip and http,
listen 2727
edit: can you try following:
NameVirtualHost *:2727
Listen 2727

SSL certificate installing

Hi ALL Apach2traid+ssl+cetificate:
I am trying to make a secure web page for payment
and this web page is for study purpose
so i thought that i may take a trial veriSign certificate
so after obtaining the certificate what should i do
and do it work if i am using my website only as localhost
finally i was told to mke a virtual server to make it run i tried the flowing
<VirtualHost localhost>
SSLCertificateFile C:\apache2triad\opssl\cert\my.cer
SSLCertificateKeyFile C:\apache2triad\opssl\cert\server.key
SSLCACertificateFile C:\apache2triad\opssl\cert\intermediate.crt
</VirtualHost>
this was in the httpd.conf
and after that the apache with ssl worker ok
but when i call a page with https
it didnt run
should i make some thing else rather than just put https
need some help and discussion please
thanks
https connects on a different port number, 443, normal http request come to port 80.
<virtualHost localhost:443>
and you'll also need to make sure apache is listening on port 443, elsewhere in your httpd.conf
listen 127.0.0.1:80
listen 127.0.0.1:443
bets of luck!
You missed (in the virtualhost):
SSLEngine on
As Fire Crow suggested, you'll also want to run it on 443. Whilst you could run HTTPS on port 80, it'd be a strange thing indeed.