# 2 Django projects deployment on AWS (same EC2 instance)

**URL:** <https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152>\
**Category:** Deployment\
**Created:** [May 25, 2023, 9:06am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152 "2023-05-25T09:06:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomcord](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/thomcord/32/13886_2.png) [@thomcord](https://forum.djangoproject.com/u/thomcord)\
**Post date:** [May 25, 2023, 9:06am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/1 "2023-05-25T09:06:27Z")

</div>

Hi, I have a Django app running on AWS. I do not have a domain name (really do not need it because the application is only for internal use). I am having really hard time to deploy my second application on the same server.

So far I have created different files configuration for each one of my application (.service and .socket ) so each one should work fine without conflicts.

My problem is that I tried everything I could and read all I found about it and could not find a solution to the following question:

"Where and how to make configurations in order to have the same IP address running both apps? Like in order to access them lets say : 1.12.123.123 for the first app and 1.12.123.123/2 for the second app

Any help will be very appreciated  
Thanks

---

<div class="post-metadata">

**Author:** ![stribny](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/stribny/32/5592_2.png) [@stribny](https://forum.djangoproject.com/u/stribny)\
**Post date:** [May 25, 2023, 10:33am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/2 "2023-05-25T10:33:13Z")

</div>

Isn’t the solution just running the applications on different ports?

---

<div class="post-metadata">

**Author:** ![thomcord](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/thomcord/32/13886_2.png) [@thomcord](https://forum.djangoproject.com/u/thomcord)\
**Post date:** [May 25, 2023, 10:42am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/3 "2023-05-25T10:42:26Z")

</div>

Thanks for the reply.

Yes, it can be. I just do not know how to do it then… could you provide an example of the configuration?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 25, 2023, 11:56am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/4 "2023-05-25T11:56:00Z")

</div>

You’ve got a couple different ways of doing this - it all depends upon how you’re deploying it.

For example, if you’re using nginx as your webserver, you would change [the `listen` directives](https://nginx.org/en/docs/http/ngx_http_core_module.html#listen) for each configuration to specify different ports. (Or, you can allow nginx to listen on standard ports and assign the different projects to “directories” within the url structure - that’s how we do it.)

Or if you’re using uwsgi directly, you can specify the ports in your ini file.

(I was going to mention doing it with gunicorn, but [gunicorn recommends running gunicorn behind nginx](https://gunicorn.org/#deployment).)

Note: I still recommend getting a domain name. if you’re paying for a static ip on EC2, you’re probably paying more for that than you would for a cheap domain. And if you’re not paying for a static ip, then you’re going to have issues to deal with when you get a different IP address.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [May 25, 2023, 2:59pm UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/5 "2023-05-25T14:59:02Z")

</div>

If your are not using other AWS service, I think is a better approach to use a cheap VPS (I use Hetzner) with a domain, It will be cheaper and more powerful. I have 5 small projects on a relative small VPS, and will downgrade the hardware because 99.99999% of the time it uses less that 10% of processor and less than 16% of ram. And as @KenWhitesell this could be cheaper than a private IP, plus you gain SSL (That I think r is a lot of more difficult with your approach)

---

<div class="post-metadata">

**Author:** ![thomcord](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/thomcord/32/13886_2.png) [@thomcord](https://forum.djangoproject.com/u/thomcord)\
**Post date:** [June 2, 2023, 9:04am UTC](https://forum.djangoproject.com/t/2-django-projects-deployment-on-aws-same-ec2-instance/21152/6 "2023-06-02T09:04:39Z")

</div>

Hi,

Thank you very much for your reply. I think that it makes more sense really do as you said. I wanted to try AWS in order to learn and see what they have to offer (which is way more then what I need) and I am using their free service.

Thank you also `@KenWhitesell` . At the end I (for the time being) just redirected to access to different ports. But like I mentioned, I will look somewhere else to host it.

Again, thank you for the time and effort put in helping me.
