Question

How to add multiple ip and add sub-domain in nginx?

I was following the nginx,uwsgi with flask tutorial. My nginx config file contains:

server {

listen 5000;
server_name 19X.X.X.X;

client_header_buffer_size 5M;
large_client_header_buffers 4 5M;
client_max_body_size 75M;

location / {
    include uwsgi_params;     
uwsgi_pass flask:8080;
}

}

Here I want to add and additional IP address like 123.345.67.8 and a subdomain test.mydomain.com. How can I add there

Subscribe
Share

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.

Hello,

Indeed as already mentioned, the best way to go is to use Nginx server blocks.

There is no need to add additional IP addresses.

Here is a quick step by step video on how to host multiple Docker containers with Nginx and Nginx server blocks:

https://www.digitalocean.com/community/questions/how-to-host-multiple-docker-containers-on-a-single-droplet-with-nginx-reverse-proxy

Even if you are not using Docker, the concept would be the same.

Best,

Bobby

Hi @somum

Here’s an article that discusses what you wish to accomplish

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

Understanding the concept of virtual host blocks in Nginx will help you with setting up the above and more different setups.