Apache order of deny,allow or allow,deny

If you as many other users sometime need to do some allow,deny in apache and can’t remember which order to use them, then here is the link to Apaches Order Directives

But in short:

Ordering is one of:

First, all Allow directives are evaluated; at least one must match, or the request is rejected. Next, all Deny directives are evaluated. If any matches, the request is rejected. Last, any requests which do not match an Allow or a Deny directive are denied by default.
First, all Deny directives are evaluated; if any match, the request is denied unless it also matches an Allow directive. Any requests which do not match any Allow or Deny directives are permitted.
This order has the same effect as Order Allow,Deny and is deprecated in its favor.

Keywords may only be separated by a comma; no whitespace is allowed between them.

Match Allow,Deny result Deny,Allow result
Match Allow only Request allowed Request allowed
Match Deny only Request denied Request denied
No match Default to second directive: Denied Default to second directive: Allowed
Match both Allow & Deny Final match controls: Denied Final match controls: Allowed

In the following example, all hosts in the apache.org domain are allowed access; all other hosts are denied access.

Order Deny,Allow
Deny from all
Allow from apache.org

In the next example, all hosts in the apache.org domain are allowed access, except for the hosts which are in the foo.apache.org subdomain, who are denied access. All hosts not in the apache.org domain are denied access because the default state is to Deny access to the server.

Order Allow,Deny
Allow from apache.org
Deny from foo.apache.org

On the other hand, if the Order in the last example is changed to Deny,Allow, all hosts will be allowed access. This happens because, regardless of the actual ordering of the directives in the configuration file, the Allow from apache.org will be evaluated last and will override the Deny from foo.apache.org. All hosts not in the apache.org domain will also be allowed access because the default state is Allow.

The presence of an Order directive can affect access to a part of the server even in the absence of accompanying Allow and Deny directives because of its effect on the default access state. For example,

<Directory /www>
Order Allow,Deny

will Deny all access to the /www directory because the default access state is set to Deny.

Posted on

How to clear NginX Reverse_proxy cache

You can also bypass/re-cache on a file by file basis using

proxy_cache_bypass $http_secret_header;

and as a bonus you can return this header to see if you got it from the cache (will return ‘HIT’) or from the content server (will return ‘BYPASS’).

add_header X-Cache-Status $upstream_cache_status;

to expire/refresh the cached file, use curl or any rest client to make a request to the cached page.

curl https://www.reck.dk/how-to-clear-ngi…erse_proxy-cache/ -s -I -H "secret-header:true"

this will return a fresh copy of the item and it will also replace what’s in cache

Posted on

Emilie Bonde Clarup synger Lis Sørensen’s Stille før storm

Offentliggjort den 25. okt. 2015
Sang: Emilie Bonde Clarup
Guitar: Nikolaj Krogh
Klaver: Olav K. Jepsen

Posted on

Emilie Bonde Clarup synger Dodo and the Dodo’s Giv Mig Skibene Tilbage

Giv Mig Skibene Tilbage, skrevet af Dodo and the Dodo’s
Sang: Emilie Bonde Clarup

PS: hun gør det godt

Posted on

Reload windows Enviroment Variables whitout restart

Hvordan kan man dog reloade Whitdows System Enviroments Variable uden at skulle genstarte eller logge ud og logge ind, og hvorfor skulle man dog dette. Jo det er jo smart hvis man gerne vil teste Variablerne man har tilføjet for at teste om FFmpeg nu virker efter man har installere fra “FFmpeg for Windows” og synes det kunne være dejligt kun at skulle taste “ffmpeg -i input.avi output.mp4” fordi man er misundelig på Linux brugerne.

Men for at kunne reloaded “Enviroment Variables” skal der bruges to scripts 1 .vbs og en .bat

I resetvars.vbs scriptet skal du putte følgende kode

Set oShell = WScript.CreateObject("WScript.Shell")
filename = oShell.ExpandEnvironmentStrings("%TEMP%\resetvars.bat")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set oFile = objFileSystem.CreateTextFile(filename, TRUE)

set oEnv=oShell.Environment("System")
for each sitem in oEnv 
    oFile.WriteLine("SET " & sitem)
path = oEnv("PATH")

set oEnv=oShell.Environment("User")
for each sitem in oEnv 
    oFile.WriteLine("SET " & sitem)

path = path & ";" & oEnv("PATH")
oFile.WriteLine("SET PATH=" & path)

I det andet script (resetvars.bat filen) skal du putte følgende kode

call "%TEMP%\resetvars.bat"

Nu skal du så eksekvere resetvars.bat for at genindlæse dine “Enviroment Variables”, og du kan gemme disse filer hvor du har lyst, eneste er at de skal ligge i samme folder

PS: Koden der skal tilføjes til “Enviroment Variables” for FFmpeg er ;C:\ffmpeg\bin i slutningen af “Path”

Posted on

How to crawl your own website to save to cache

You can use wget for that. After setting the http_proxy environment variable to point to your proxy run it with options similar to below (linux commands below).

export http_proxy=

wget --cache=off --delete-after -m http://www.mywebsite.org

If you only need to heat the cache server with static files you can do one of the following things

  1. Use the find command and paste the output to either curl or wget like this
    for path in $(find /full/path/to/files/ -type f -printf "%f\n"); do wget --cache=off --delete-after -m https://static.domain.tld/rewriten-path/$path; done;
  2. By using Curl
    for path in $(find /full/path/to/files/ -type f -printf "%f\n"); do curl -I https://static.domain.tld/rewriten-path/$path; done;
  3. Another way is to make a list of files, then rewrite results into urls that you paste into curl
    find /full/path/to/files/ -type f -printf "%f\n" >> output.txt; xargs -n 1 curl -I https://static.domain.tld/ < output.txt

Posted on

InnoDB table optimization w/o locking table

I’ve noticed a significant amount of performance gain if I repack a table (ALTER TABLE foo ENGINE = INNODB) after some period of time, or many after a heavy volume of INSERT/UPDATE/DELETEs. I don’t know if this is because indicies etc are rebuilt, or compacting the table space, or something else?

It strikes me that doing something like ALTER TABLE foo ENGINE = INNODB should be a part of routine table maintenance, however using OPTIMIZE or ALTER locks the table which is unacceptable, is there is a good way to do with with one database server (meaning no failing over to another instance) w/o locking the entire table?

Update: Using Percona 5.5.17-55

Update: SHOW VARIABLES LIKE ‘innodb%’;

| Variable_name                          | Value                  |
| innodb_adaptive_checkpoint             | estimate               |
| innodb_adaptive_flushing               | OFF                    |
| innodb_adaptive_hash_index             | ON                     |
| innodb_additional_mem_pool_size        | 8388608                |
| innodb_auto_lru_dump                   | 120                    |
| innodb_autoextend_increment            | 8                      |
| innodb_autoinc_lock_mode               | 1                      |
| innodb_buffer_pool_shm_checksum        | ON                     |
| innodb_buffer_pool_shm_key             | 0                      |
| innodb_buffer_pool_size                | 30064771072            |
| innodb_change_buffering                | inserts                |
| innodb_checkpoint_age_target           | 0                      |
| innodb_checksums                       | ON                     |
| innodb_commit_concurrency              | 0                      |
| innodb_concurrency_tickets             | 500                    |
| innodb_data_file_path                  | ibdata1:10M:autoextend |
| innodb_data_home_dir                   |                        |
| innodb_dict_size_limit                 | 0                      |
| innodb_doublewrite                     | ON                     |
| innodb_doublewrite_file                |                        |
| innodb_enable_unsafe_group_commit      | 0                      |
| innodb_expand_import                   | 0                      |
| innodb_extra_rsegments                 | 0                      |
| innodb_extra_undoslots                 | OFF                    |
| innodb_fast_checksum                   | OFF                    |
| innodb_fast_recovery                   | OFF                    |
| innodb_fast_shutdown                   | 1                      |
| innodb_file_format                     | Antelope               |
| innodb_file_format_check               | Barracuda              |
| innodb_file_per_table                  | ON                     |
| innodb_flush_log_at_trx_commit         | 0                      |
| innodb_flush_log_at_trx_commit_session | 3                      |
| innodb_flush_method                    | O_DIRECT               |
| innodb_flush_neighbor_pages            | 1                      |
| innodb_force_recovery                  | 0                      |
| innodb_ibuf_accel_rate                 | 100                    |
| innodb_ibuf_active_contract            | 1                      |
| innodb_ibuf_max_size                   | 15032369152            |
| innodb_io_capacity                     | 200                    |
| innodb_lazy_drop_table                 | 0                      |
| innodb_lock_wait_timeout               | 50                     |
| innodb_locks_unsafe_for_binlog         | OFF                    |
| innodb_log_block_size                  | 512                    |
| innodb_log_buffer_size                 | 67108864               |
| innodb_log_file_size                   | 402653184              |
| innodb_log_files_in_group              | 2                      |
| innodb_log_group_home_dir              | ./                     |
| innodb_max_dirty_pages_pct             | 75                     |
| innodb_max_purge_lag                   | 0                      |
| innodb_mirrored_log_groups             | 1                      |
| innodb_old_blocks_pct                  | 37                     |
| innodb_old_blocks_time                 | 0                      |
| innodb_open_files                      | 300                    |
| innodb_overwrite_relay_log_info        | OFF                    |
| innodb_page_size                       | 16384                  |
| innodb_pass_corrupt_table              | 0                      |
| innodb_read_ahead                      | linear                 |
| innodb_read_ahead_threshold            | 56                     |
| innodb_read_io_threads                 | 4                      |
| innodb_recovery_stats                  | OFF                    |
| innodb_replication_delay               | 0                      |
| innodb_rollback_on_timeout             | OFF                    |
| innodb_show_locks_held                 | 10                     |
| innodb_show_verbose_locks              | 0                      |
| innodb_spin_wait_delay                 | 6                      |
| innodb_stats_auto_update               | 1                      |
| innodb_stats_method                    | nulls_equal            |
| innodb_stats_on_metadata               | ON                     |
| innodb_stats_sample_pages              | 8                      |
| innodb_stats_update_need_lock          | 1                      |
| innodb_strict_mode                     | OFF                    |
| innodb_support_xa                      | ON                     |
| innodb_sync_spin_loops                 | 30                     |
| innodb_table_locks                     | ON                     |
| innodb_thread_concurrency              | 8                      |
| innodb_thread_concurrency_timer_based  | OFF                    |
| innodb_thread_sleep_delay              | 10000                  |
| innodb_use_purge_thread                | 1                      |
| innodb_use_sys_malloc                  | ON                     |
| innodb_use_sys_stats_table             | OFF                    |
| innodb_version                         | 1.0.16-12.8            |
| innodb_write_io_threads                | 4                      |

Posted on

How to copy data from one table to another new table in MySQL?

If you want to copy data from one table to another in MySQL

If you don’t want to list the fields, and the structure of the tables is the same, you can do:

INSERT INTO `table2` SELECT * FROM `table1`;

or if you want to create a new table with the same structure:

CREATE TABLE new_tbl [AS] SELECT * FROM orig_tbl;

Posted on

Carlos Vives, Shakira – La Bicicleta (Official Video)

Carlos Vives, Shakira – La Bicicleta (Official Video)

Posted on

Redbarnes “anonyme” anmeldelse er ikke anonym!

Redbarnet har endnu en falsk kampagne om at det skulle være anonymt at angive børneporno, men som sædvanligt er det fis i en hornlygte, der foretages faktiskst rigtigt meget logning af hvem du er og hvor du er.

Lad os starte med at tage et kig i headeren af deres hjemmeside.

    1. logning er til google analyticts.. UPS nu har redbarnet adgang til mere viden om dig end din evt. sambo og andre…
span class="start-tag">link href="http://stopdigitaleovergreb.nu/redbarnet" rel="canonical" />           
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          ga('create', 'UA-57029888-1', 'auto');
          ga('send', 'pageview');
  1. Så til næste del af headeren på deres hjemmeside
    link rel="profile" href="http://gmpg.org/xfn/11"

    mon ikke gmpg.org nu også har logget dig?

  2. Så er der Redbarnets pingback
    link rel="pingback" href="http://stopdigitaleovergreb.nu/redbarnet/xmlrpc.php"

    bare næste skridt for at sikre sig din identitet

  3. Så kommer vi til at de også lader Facebook foretage en logning af dig
    meta property="article:publisher" content="https://www.facebook.com/redbarnet"
  4. Sørme om vi også lige skal sikre os du er logget hos twitter
    meta name="twitter:card" content="summary"
  5. Vi skal da også logges hos
    link rel='dns-prefetch' href='//s.w.org'


    script type="text/javascript">
                window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/stopdigitaleovergreb.nu\/redbarnet\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}};
                !function(a,b,c){function d(a){var b,c,d,e,f=String.fromCharCode;if(!k||!k.fillText)return!1;switch(k.clearRect(0,0,j.width,j.height),k.textBaseline="top",k.font="600 32px Arial",a){case"flag":return k.fillText(f(55356,56826,55356,56819),0,0),!(j.toDataURL().length<3e3)&&(k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57331,65039,8205,55356,57096),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57331,55356,57096),0,0),c=j.toDataURL(),b!==c);case"emoji4":return k.fillText(f(55357,56425,55356,57341,8205,55357,56507),0,0),d=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55357,56425,55356,57341,55357,56507),0,0),e=j.toDataURL(),d!==e}return!1}function e(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i,j=b.createElement("canvas"),k=j.getContext&&j.getContext("2d");for(i=Array("flag","emoji4"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h
  6. De reklamere via eks. trafficjunky.com der har logning om hvem der er vist reklame til og hvem der trykker på deres reklamer, så her er ikke mindre end to logninger
  7. Din ISP (Internet udbyder) har logget din webaktivitet så der ligger din IP adresse også og sladre
  8. Det link der blev genereret via trafficjunky er unikt

    (noget er klippet ud af dette ident)

  9. Lidt længere nede foregår der et kald til schema.org
    address itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
  10. Lidt længere nede igen foregår der et kald til statcounter.com
    -- Start of StatCounter Code --;
        -- var sc_project=10808799; var sc_security="9a4bff8e"; var sc_invisible=1; var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www."); //-->
    document.write("<sc "+"ript src='" +scJsHost +"statcounter.com/counter/counter.js'>");
    a title="web analytics" href="https://statcounter.com/"> img class="statcounter" src="https://c.statcounter.com/10808799/0/9a4bff8e/1/" alt="web analytics" /
  11. Og sidst men ikke mindst, hvornår er en http protokol blevet sikker og derved med til at sikre din anonymitet? havde den opfattelse som it bøv at man havde opfundet httpS for at man derved havde bedre sikkerhed ved at den angivne traffik er krypteret?
  12. Skulle du være så fjollet at bruge google Chrome som din browser, nå ja, så er du også logget hos instagram og Google 🙂

Den samlede konklusion er jo at Redbarnet faktiskt gør ALT for at afslører hvem DU er, så anonymitet min bare…. Så god fornøjelse med din IKKE anonymitet og jeg vil ikke ligge skjul på min forargelse over hvordan man forsøger at stikke folk blår i øjnene…. Det stinker af rådent samfundsmoral….

Link til den fulde kildekode fra Redbarnts hjemmeside Kildekode

Posted on