0

I have a website running on a server that redirects all HTTP requests to HTTPS as shown below. I also have a few Django APIs that the server serves (let's say https://www.example.com/apis/log). I am running the Django implementation on Ubuntu + Nginx and have installed SSL certificate using Let's Encrypt.

server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name xxx.xx.xx.xx example.com www.example.com;
    listen 80;
    return 404; # managed by Certbot
}

Now, I would like to do the following:

1
  • configure nginx to serve api on HTTP Commented Jun 18, 2019 at 4:19

1 Answer 1

1

in your nginx configuration

server {
    listen 80;
    listen 443 default_server ssl;

    # other directives
}

80 - for http and 443 - for https

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.