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 9212973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:38:40+00:00 2026-06-18T01:38:40+00:00

I am trying to get cache-comtrol to work. In nginx I have the following:

  • 0

I am trying to get cache-comtrol to work.

In nginx I have the following:

    location /static/ {
        alias /home/ubuntu/workspace/mysite;
        expires max;
        add_header Cache-Control public;
    }

in mysite dir I have static. In static I have the dirs for js, css, and images.

In the web browser I get 404 error. Images cant be found. If I remove location /static/ this site works but I have no cache-control.

How do I resolve?

  • 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-18T01:38:41+00:00Added an answer on June 18, 2026 at 1:38 am

    If you use url like: http://your.page.com/static/image.gif then with your rules you get such uri (including alias directive):

    /home/ubuntu/workspace/mysiteimage.gif;
    

    So conclusion is that remove last / from location directive (it should be /static) or add at the end to alias directive / (so it will be as alias /home/ubuntu/workspace/mysite/;)

    Other solution could be like:

    location ~ (static/.*) {
       alias /home/ubuntu/workspace/mysite/$1;
       # ... rest of code here
    }
    

    Then you don’t have to add static again in alias directive. You just use it as location param ($1 = static/.*).

    Why that way? alias directive (alias doc) work as follow: it trims from requested url part matched in location directive end then, with what will stay, append to it own rule path. In your example from url /static/image.gif/ it will trim /static/ and to your alias path append only image.gif so it will look like I wrote: /home/ubuntu/workspace/mysiteimage.gif/`.

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

Sidebar

Related Questions

Trying to create a new Dedicated Cache Role in Windows Azure but get the
I am trying get Struts 2 and Tiles to work and I am using
Trying to get this expression to work, can someone look at it and tell
I've been trying to get PHPExcel to work with my Joomla. If the script
I've been trying to work wit the ZEND GData API in CakePHP and have
I'm trying to get the jQuery Tokeninput plugin to work with my mvc application
I get the following error trying to do an XHR request. I've setup CORS
I have been trying to get the request url as follows import webapp2 class
Can we get list of output cached URLs in IIS7? I am trying to
So i am trying get 2 div-containers which both should contain centered text (Both

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.