# Disable serve static files

**URL:** https://meta.discourse.org/t/disable-serve-static-files/66341
**Category:** Development
**Created:** [July 17, 2017, 8:47pm UTC](https://meta.discourse.org/t/disable-serve-static-files/66341 "2017-07-17T20:47:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![leo.proctor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leo.proctor/32/216158_2.png) [@leo.proctor](https://meta.discourse.org/u/leo.proctor)
#### Post date: [July 17, 2017, 8:47pm UTC](https://meta.discourse.org/t/disable-serve-static-files/66341/1 "2017-07-17T20:47:54Z")

</div>

Somehow i want to disable public access to assets. In development by `config.serve_static_files = false`, it serves the purpose. It routes requests to upload controller, where i can authenticate or deny access. While in production it doesn’t seem to be working. In my app.yml file

> DISCOURSE\_SERVE\_STATIC\_ASSETS: false

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 17, 2017, 8:54pm UTC](https://meta.discourse.org/t/disable-serve-static-files/66341/2 "2017-07-17T20:54:37Z")

</div>

On production assets are served by nginx:

```plaintext
    location ~ ^/assets/(?<asset_path>.+)$ {
      expires 1y;
      brotli_static on;
      gzip_static on;
      add_header Cache-Control public,immutable;
    }

```

---

<div class="post-metadata">

### Author: ![leo.proctor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leo.proctor/32/216158_2.png) [@leo.proctor](https://meta.discourse.org/u/leo.proctor)
#### Post date: [July 17, 2017, 9:01pm UTC](https://meta.discourse.org/t/disable-serve-static-files/66341/3 "2017-07-17T21:01:01Z")

</div>

Ahan, Can I somehow change ngnix configuration from outside container? may be in app.yml?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [July 17, 2017, 10:48pm UTC](https://meta.discourse.org/t/disable-serve-static-files/66341/4 "2017-07-17T22:48:00Z")

</div>

Yes, you’ll need to write a custom pups config statement to remove the config from the nginx config file.
