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

  • Home
  • SEARCH
  • 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 8449659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:46:16+00:00 2026-06-10T10:46:16+00:00

I’ve read the docs, scanned examples, and I cannot for the life of me

  • 0

I’ve read the docs, scanned examples, and I cannot for the life of me figure out why this isn’t working. I’m totally new to nginx, so if this is a stupid simple answer, go easy on me, please.

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        #include /etc/nginx/conf.d/*.conf;
        #include /etc/nginx/sites-enabled/*;

    server {
                listen       80;
                server_name  localhost domain.com;

                root /home/TMlabs/server_files;
                index index.html index.htm;

                location = /othersite {
                    root /home/TMlabs/server_files/location2;
                    index index.html index.htm;
                }

                location / {
                    root   /home/TMlabs/server_files/location1;
                    index  index.html index.htm;
                }

        }

If I need to include more, let me know and I’ll dump the whole nginx.conf. It’s pretty basic, though.

All I’m trying to achieve is mapping domain.com to the root specified in location / (which is working) and mapping domain.com/othersite to the root specified in that directive. For some reason, it returns the /home/TMlabs/server_files/location1/index.html document when i navigate to domain.com/othersite rather than the index.html file from the /home/TMlabs/server_files/location2 folder. I’ve tried removing the equals and using the different operators available for matching, but nothing seems to work. it’s probably something pretty basic that I am misunderstanding, being new to this stuff. I also suck at regexp. anyone care to enlighten?

edit: I think what is happening is that it is actually ignoring my directives entirely and is simply using /usr/share/nginx/wwwas the document root. I don’t see this config anywhere; what am I missing?

  • 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-10T10:46:18+00:00Added an answer on June 10, 2026 at 10:46 am

    The = prefix means that the location specified should exactly match the requested URL. If you look up the error log, you will see that Nginx tries to serve the file
    [...]/location2/otherside, and not [...]/location2/index.{html,htm}. (full paths omited for simplicity)

    index directives are a noop inside an exact-match location.

    To work around this, you can either rename your file to otherside and have this configuration

    location = /otherside {
        root /home/TMlabs/server_files/location2;
    }
    

    or use the alias directive

    location = /otherside {
        alias [...]/location2/index.html;
    }
    

    PS: Nginx will try to figure the Content-Type of the response by the extension of the URL. Since /otherside does not have an extension, it will use application/octet-stream causing the browser to try and download the content.

    You can either include the .html extension, or use the default_type directive inside location

    default_type "text/html";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.