linuxdjangoubuntunginx

Testing nginx without domain name


enter image description here

I'm working through https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04 . I've reached the end of the tut and started both uwsgi and nginx as directed. I have been able to get all steps working including uwsgi as far as I am aware.

My test django site is in /home/deploy/sample as in the screenshot

If I

 sudo vim /etc/nginx/sites-available/sample

I see:

server {
listen 80;
server_name sample.com www.sample.com;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/deploy/sample;
}

location / {
    include         uwsgi_params;
    uwsgi_pass      unix:/run/uwsgi/sample.sock;
}
}

Under "Install and Configure Nginx as a Reverse Proxy" the article states:

Inside, we can start our server block by indicating the port number and domain name where our first project should be accessible. We'll assume that you have a domain name for each:

I don't have a domain set up yet, but I wanted to open my VPS's ip address in my browser to see the test site.

How can I make this happen?


Solution

  • You can just use your VPS's ip in place of "sample.com":

    server {
        listen 80;
        server_name <your_ip_address>;
    
        <other stuff>
    
    }
    

    If you haven't already, you may want to assign a static IP; I believe Digital Ocean gives you some free ones.