I’ve been pulling my hair out trying to figure out how to get SSL encryption working on my Ghost install. I have Ghost 0.4.2 installed on an Ubuntu 12.04 droplet. I’ve followed every guide out there on how to configure Nginx to support SSL. I’m probably reaching a point of no return since I’ve copied and pasted so many things, and I’ve probably really screwed up somewhere along the way. Below is my Nginx configuration file. My SSL certificate works, and I can service nginx restart
without a problem. However, no matter what page I go to, I cannot use https. Chrome sits for about 10 seconds, then takes me to “This webpage is not available.”
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
root /usr/share/nginx/www;
index index.html index.htm;
server_name localhost;
ssl_certificate /etc/nginx/ssl/redacted.com.crt;
ssl_certificate_key /etc/nginx/ssl/redacted.key;
location / {
proxy_pass http://localhost:2368/;
proxy_set_header Host $host;
proxy_buffering off;
}
}
I have also tried manually adding 443 to my iptables, which doesn’t fix anything either.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
I seem to have figured it out.
First of all, my iptables wasn’t saving, nor was it being applied to my rules. I needed to do these two commands:
That finally opened port 443. However, my Nginx configuration was still wrong. I kept getting endless redirect loop warnings, I’d tweak it a little, get some 404 errors, tweak it again and get “Welcome to Nginx”. I finally found the right combination that I need to run https, and force it on my Admin page. My Nginx config is below:
Here’s the netstat output:
Nmap doesn’t show 443. I had to run with -Pn since it was saying it was being blocked. I ran Nmap with my droplet IP address. Is this correct? Here’s the output:
The iptables command I used was
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
. However, I’m not seeing it in my iptables output. How do I save iptables after I’ve made a modification to it?service iptables save
andservice iptables restart
do not work. Here’s myiptables --list
output:You Nginx configuration looks fine. It sounds like you might not have port 443 open. What was the iptables command you used?
Let’s debug this a little further. On the droplet, run:
If Nginx is listening on port 443, you should see it listed in the output.
Next, from a different machine run:
This will show what ports are open to the outside. Again, you should see port 443 in the output.
If it is in the output of
netstat
but notnmap
that implies that your firewall is still getting in the way. If it is not in thenetstat
output at all, then your problem will most like be related to Nginx.