help cannot add mod_rewrite in nginx site configuration
iLinux85
nginx-forum at nginx.us
Sat Aug 16 12:29:37 UTC 2014
hello
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;
server_name example.net www.example.net;
#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 ~*
^/(js\/|css\/|images\/|img\/|player\/|favicon\.ico|crossdomain\.xml|catalogue\.rss)
{
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_pass http://example.net/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 response
# 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_redirect http://www.example.net:8070 http://www.example.net;
proxy_redirect http://example.net:8070 http://example.net;
proxy_pass http://192.168.1.1:8070;
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: http://forum.nginx.org/read.php?2,252614,252614#msg-252614
More information about the nginx
mailing list