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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:32:04+00:00 2026-06-04T06:32:04+00:00

Seeking help from Nginx experts here. I want to block people accessing CSS or

  • 0

Seeking help from Nginx experts here.

I want to block people accessing CSS or JS directly from my website. A bit like this: http://assets.behance.net/

I got this reference from ServerFault:
https://serverfault.com/a/332493/117595

location ~* (\.jpg|\.png|\.gif|\.jpeg|\.png)$ {
 valid_referers none blocked www.example.com example.com;
 if ($invalid_referer) {
    return 403;
 }
}

But a few questions:

  1. In the valid_referers, how should I include all the domains from my vhosts directory, which contains the server block for all my domains on this server. (It’s a dedicated WHM server with many Cpanel domains.) I would prefer this list of allowed domains to somehow be automated, in case we add more domains in the future.

  2. More importantly, how can I make this in the main “http” block, and not server by server (i.e., the vhosts for each domain!)?

  3. Isn’t the “IF” condition going to make the Nginx server slower? We have stayed away from all IF blocks so far as I remember reading this has a significant adverse influence on performance.

Thanks!

  • 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-04T06:32:08+00:00Added an answer on June 4, 2026 at 6:32 am

    Thanks @dmitry-paskal. I’ll keep skipping “none”. But the thing is that the 403 message is coming from nginx default. I have this in my “Server” block:

    error_page 404 /404.html;
    location = /404.html {
      root   /etc/nginx/html;
      internal;
    }
    error_page 403 /403.html;
      location = /403.html {
      root   /etc/nginx/html;
      allow all;
    }
    error_page 500 502 503 504  /500.html;  
      location = /500.html {  
      root  /etc/nginx/html;  
    }  
    

    And the directory /etc/nginx/html is chmod 777.

    The docs and all the google search results I’ve found suggest that the above code should work. What am I missing, how can I show my own 403 page?

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

Sidebar

Related Questions

i want your help very badly..bcz i am seeking an answer for this from
Seeking help to design a layout as shown here: http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en The major challenge I
I'm seeking help to push in value parse from XML based on certain filter/word
Ok, so I found a question in this post here: SELECT * FROM help
Seeking your help to get off .epub(s) sea in iPhone world... I am trying
I am newbie in Ruby.. seeking some help.. I have a code DB =
Seeing some strange things; help is being solicited. I have a query, like so:
Just seeking confirmation here : apache Thrift protocol does not seem to support running
Seeking some help to determine what the heck is the issue as to why
i am seeking help on a query which shows movement of a stock item

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.