Forum: NGINX help cannot add mod_rewrite in nginx site configuration

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 iLinux85 (Guest)
on 2014-08-16 14:30
(Received via mailing list)

i don't know how to add this code
        rewrite "^/([0-9A-Za-z]{12})(\/.+|\.html?|)$"
   /dl?op=download1&id=$1&fname=$2                         last;
        rewrite "^/embed-([0-9A-Za-z]{12})\.html$"
   /dl?op=embed&file_code=$1                               last;
        rewrite "^/embed-([0-9A-Za-z]{12})-(\d+)x(\d+)\.html$"
   /dl?op=embed&file_code=$1&w=$2&h=$3             last;
        rewrite "^/embed-(\w{2,3})-([0-9A-Za-z]{12})-(\d+)x(\d+)\.html$"
   /dl?op=embed&file_code=$2&w=$3&h=$4&channel=$1  last;
        rewrite "^/vidembed-([0-9A-Za-z]{12})"
   /dl?op=embed2&file_code=$1                      last;
        #rewrite        "^/dl$"
           /dl                                                     last;

inside nginx configuration site

    server {
        error_log /usr/local/nginx/logs/vhost-error_log warn;
        listen       80;
        #proxy_set_header X-Real-IP $remote_addr;

        #Remove trailing slash
        rewrite ^/(.*)/$ /$1 permanent;

        set $fcgi_index_dl_on "1";
        #set $fcgi_index_on "1";

    location ~ dl$ {
        include fastcgi.conf;
        limit_conn addr 2;
        if ( $fcgi_index_dl_on ) {
            root /home/tubro/public_html/cgi-bin;
            fastcgi_pass localhost:9011;

#    location ~*

location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
               root         /home/site/public_html;
               access_log   off;
               expires      30d;

    location /home/site/public_html/cgi-bin/fs.cgi {
            proxy_set_header   X-Real-IP        $remote_addr;
            charset  utf-8;
            #limit_conn   addr  30;

    location / {

   proxy_send_timeout   90;
   proxy_read_timeout   90;

   proxy_buffer_size    4k;
   # you can increase proxy_buffers here to suppress "an upstream
   #  is buffered to a temporary file" warning
   proxy_buffers     16 32k;
   proxy_busy_buffers_size 64k;
   proxy_temp_file_write_size 64k;

   proxy_connect_timeout 30s;



   proxy_set_header   Host   $host;
   proxy_set_header   X-Real-IP  $remote_addr;
   proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        #limit_conn addr 3;
        #limit_req zone=one burst=5;

        error_page  404              /404.html;
        error_page  500 502 503 504  /50x.html;

Posted at Nginx Forum:,252614,252614#msg-252614
This topic is locked and can not be replied to.