Problems setting up an nginx server

I have successfully set up an nginx server with django with the following settings:

Settings at domain registrar:

Digital Oceans DNS nameservers

Nginx settings:

 	server {
        return 301 $scheme://$request_uri;
    server {
        access_log off;

        location /static/ {
            alias /home/wt_konsulat_env/static/;

        location / {
                proxy_set_header X-Forwarded-Host $server_name;
                proxy_set_header X-Real-IP $remote_addr;
                add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';

Now I want to do the same thing with another domain (, but this time I can’t change the DNS settings at the domain registrar as the domain is hosted with someone else and the email server should not run via DO. That’s why only a DNS A record is placed (for pointing to the ip of my DO server. When I leave the nginx settings unchanged, accessing redirects me to, which I assume is the correct behavior.

**But what I want is to only have (I only used for testing purposes). So when accessing I don’t want it to redirect to, I want it to show the django website as ** I have tried various settings without success. I am new to nginx and would appreciate any help you can give me!


it is on that droplet

Where is the django site you want to be displayed for Is it on this droplet, on another server, etc?

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi @krarve,

If I’m understanding you correctly you’d like to run a different application for than, and you’d like to simply have NGINX direct the inbound connections to each of the django applications. If so, you could do this with server blocks within NGINX as described here:

If this is not the case, and you’d like the same application to display different templates/content for each of the websites, and do all of this within django, that’s probably going to be a lot more work than simply running two copies of the django application (which I’d suggest doing instead).

Let me know if you have any further questions! and if this doesn’t get you sorted, please let us know!