Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8952007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:46:35+00:00 2026-06-15T13:46:35+00:00

I have a django project and want to deploy it using gunicorn and nginx.

  • 0

I have a django project and want to deploy it using gunicorn and nginx.

So far everything works, but when I add subdomains, static files are not served and my page look terrible!

If I use localhosts instead, everything works perfect!

Here I leave my nginx.conf:

server {
    listen 80 default;
    client_max_body_size 4G; 
    server_name mytest.dev;

    keepalive_timeout 5;

    # path for static files
    root /Users/danielrodriguez/workspace/mtt/static;

    location / { 
        # checks for static file, if not found proxy to app 
        try_files $uri @proxy_to_app;
    }   

    location @proxy_to_app {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        proxy_pass   http://localhost:8000;
    }   
}

I also have this in my hosts file:

127.0.0.1   localhost
127.0.0.1   mytest.dev
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

How can I make nginx to work as it does when I type “localhost” in my browser when I type “mydev.test”? Pretty much all I want to do is serve a bunch of sites within the same physical server using something like virtualhosts in apache.

PD: I’m also using OS Lion in case it helps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:46:35+00:00Added an answer on June 15, 2026 at 1:46 pm

    That seems you have wrong root setting.

    root /Users/danielrodriguez/workspace/mtt/static;
    

    You should check the requested URL for your css files. Assumimg you have STATIC_URL = '/static/' you’re browser will probably want to load /static/css/styles.css or something like that.

    So, the file ./static/css/styles.css should be found in root directory.

    Then right root should be:

    root /Users/danielrodriguez/workspace/mtt;
    

    Of course that’s really not good idea to make root setting to your project root. So’ you may create symlink for static and media to separate dir outside your project.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django project that I have been using for a while, but
I have a Django project using Tastypie as its main API and it works
I have a django project, but for some reason basic jquery isn't working. <html>
Good people, I have installed djangoratings in my django project and i want to
I want to have 2 separate admin sites inside a Django project. By separate
I am using Sphinx with autodoc for documenting my Django project. Design guys want
I have a Django project using https for certain part of the url (/account/,
I have a Django project for a simple blog/forum website I’m building. I’m using
I have a django project using multiple databases. I am using django-nose as the
I want to have 2 separate admin sites inside a Django project. First is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.