Skip to content

Instantly share code, notes, and snippets.

@negamist
Forked from alsyundawy/cdn-nginx.conf
Created September 7, 2021 13:49
Show Gist options
  • Save negamist/acf3a4a3b424e3bb1fbdd6ba4bcc7d0c to your computer and use it in GitHub Desktop.
Save negamist/acf3a4a3b424e3bb1fbdd6ba4bcc7d0c to your computer and use it in GitHub Desktop.

Revisions

  1. @alsyundawy alsyundawy revised this gist Mar 1, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions cdn-nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    server {
    listen 80;
    server_name cdn.linuxsec.org;
    server_name cdn.domain.org;
    root /usr/share/nginx/cdn

    location / {
    proxy_pass http://linuxsec.org;
    proxy_pass http://domain.org;
    proxy_set_header Host $host;
    proxy_set_header True-Client-IP $remote_addr;

    @@ -13,7 +13,7 @@ server {
    location ~* .(jpg|png|gif|jpeg|webp|css|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
    expires max;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://linuxsec.org;
    proxy_pass http://domain.org;
    proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
    proxy_store /usr/share/nginx/cdn$uri;
    proxy_store_access user:rw group:rw all:r;
  2. @0xAsuka 0xAsuka created this gist Jul 5, 2017.
    29 changes: 29 additions & 0 deletions cdn-nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    server {
    listen 80;
    server_name cdn.linuxsec.org;
    root /usr/share/nginx/cdn

    location / {
    proxy_pass http://linuxsec.org;
    proxy_set_header Host $host;
    proxy_set_header True-Client-IP $remote_addr;

    }

    location ~* .(jpg|png|gif|jpeg|webp|css|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
    expires max;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://linuxsec.org;
    proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
    proxy_store /usr/share/nginx/cdn$uri;
    proxy_store_access user:rw group:rw all:r;
    }
    #blokir htaccess
    location ~ /\. { deny all; }

    #blokir temp file dengan awalan $
    location ~ ~$ { deny all; }

    #blokir akses php file
    location ~ \.php$ { deny all; }
    }