1👍
You configured nginx to serve myapp2.com on port 8000:
server {
listen 8000;
server_name myapp2.com;
# ...
}
so why would you expect nginx to serve it on port 80 ?
[edit] I thought the above was enough to make the problem clear but obviously not, so let’s start again:
You configured nginx to serve myapp2.com on port 8000 (the listen 8000;
line in your conf, so nginx do what you asked for: it serves myapp2.com on port 8000.
If you want nginx to serve myapp2.com on port 80 (which is the implied default port for http so you don’t have to specify it explicitely in your url – IOW ‘http://myapp2.com/‘ is a shortcut for ‘http://myapp2.com:80/‘), all you have to do is to configure nginx to serve it on port 80 just like you did for ‘myapp.com’: replace listen 8000;
by listen 80;
.
1👍
If you don’t type in a port, your client will automatically use port 80.
Typing myapp2.com
is the same as typing myapp2.com:80
But myapp2.com
is not running on port 80, it’s running on port 8000.
When you go into production it is possible to redirect myapp2.com
to port 8000 without explicitly typing it. You register myapp2.com with a DNS name server and point it towards myapp2.com:8000
- [Answered ]-Django Rest Framework: How to get value of the ForeignKey
- [Answered ]-Django – how to restrict number of pages an unauthenticated user can view
- [Answered ]-How i can upload an image with CreateView on my post?
- [Answered ]-Django: what is the difference between redirect to a view function and redirect to a url (from urls.py file)
- [Answered ]-Django can not send email when deployed by nginx+uwsgi+Django