-1

So I have been working on a project on a separate server for a company and now they want me to set it up for production with their SSL certificate and Key.

Here is my nginx.config file that is on the server I am working on
`

server{
    listen       443;
    ssl          on;
    ssl_certificate "/etc/pki/tls/certs/example.cer";
    ssl_certificate_key "/etc/pki/tls/certs/exampleKey.pem";
    #ssl_session_cache shared:SSL:1m;
    #ssl_session_timeout  10m;
    #ssl_ciphers HIGH:!aNULL:!MD5;
    #ssl_prefer_server_ciphers on;
    server_name snap.example.gov;


    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
            proxy_pass http://localhost:80;
            proxy_redirect off;
            proxy_set_header Host $host ;
            proxy_set_header X-Real-IP $remote_addr ;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
            proxy_set_header X-Forwarded-Proto https;
     }`

I've tried to follow all the tutorials but it still won't load over 'snap.example.gov'. I really need help to get this to load over https on the 'snap.example.gov' domain. What am I doing wrong? I'm still new to this so I'm not quite sure what to do.

Thank you guys in advance.

BStill
  • 894
  • 1
  • 9
  • 33
  • "Won't load" is not descriptive enough. Are you getting any errors? What happens? Did you look in the nginx error log files? – Rob Nov 24 '17 at 01:34
  • Do you get an SSL error when attempting to use HTTPS protocol? – Mo Ali Nov 24 '17 at 02:33
  • @Rob sorry about that, I'm not too familiar with this subject. So it lets me run nginx with no errors, but when i enter 'snap.example.gov' into the address bar it says the IP address can not be reached. I can still get to the site if I enter in the IP address. – BStill Nov 24 '17 at 03:23
  • @MoAli It tells me the IP address can't be reached. – BStill Nov 24 '17 at 03:24
  • What happens when you just enter the IP address into the browser address bar? Did you set up DNS with a service? – Rob Nov 24 '17 at 03:34
  • @Rob When I enter the IP address it opens up my website. I have not set a DNS with a service. All I have done was put my project onto a CentOS server and ran nginx on it. – BStill Nov 24 '17 at 17:10
  • That is the problem. I'll give a complete answer when I get home later today – Rob Nov 24 '17 at 18:41
  • @Rob I would appreciate that, Thank You! – BStill Nov 24 '17 at 19:13

1 Answers1

0

All the world is the internet and IP addresses are but its players. How does your computer know which computer server to connect to when you type 'snap.example.gov'? The answer is, it doesn't! Thus began the Domain Name System which affords your operating system the ability to go on the internet and query a series of well known servers that do know the IP address of every registered domain name on the internet. DNS knows that the IP address of stackoverflow.com is 151.101.65.69. Your computer doesn't.

So, you have to register your server's domain name with those DNS servers and tell them what the IP address to access your site is. The fee for this service is as low as $11 or so but can be up to $50 assuming the name is available at all. example.gov, for example, is owned by the GSA of the United States government so you are not likely going to be able to register that name.

There are a large number of domain name registrars and stackoverflow does not really like us to recommend one but searching for that will bring up some good ones.

Rob
  • 14,746
  • 28
  • 47
  • 65
  • Thank you, that helps me understand that better. But what if the domain name is already registered and I want to add my site to a sub-domain? I have the wildcard certificate and private key to the site. Do I use that when setting up the DNS? @Rob – BStill Nov 25 '17 at 00:25
  • You can't do anything if a domain is registered by someone else. A sub-domain is attached to the main domain name so you have no control of that either. – Rob Nov 25 '17 at 00:49
  • I figured. Thank you for the help. – BStill Nov 25 '17 at 01:02