Disable TLSv1 in Nginx

nmap

To disable TLSv1 in nginx, add ssl_protocols TLSv1.1 TLSv1.2; in your server config. if you are using letsencrypt SSL, edit file vi /etc/letsencrypt/options-ssl-nginx.conf Find ssl_protocols TLSv1 TLSv1.1 TLSv1.2; Replace with ssl_protocols TLSv1.1 TLSv1.2; Restart Nginx service nginx restart To verify, run nmap –script ssl-enum-ciphers -p 443 DOMAIN.EXTN This will list all supported SSL protocols. Nginx … Read more

Nginx Rails Origin header didn’t match request.base_url

Nginx Web Server

After installing SSL on Nginx server, rails application login page stopped working. On log file (log/production.log), found following error HTTP Origin header (https://domain.com) didn’t match request.base_url (http://domain.com) The Nginx config used was upstream app { server unix:/var/www/public/shared/sockets/unicorn.sock fail_timeout=0; } server { listen 443 ssl; root /var/www/public; ssl_certificate /etc/ssl/ssl.crt; ssl_certificate_key /etc/ssl/ssl.key; server_name domain.com; try_files $uri/index.html $uri … Read more

Nginx Disable Access log

Nginx Web Server

On a high traffic web site, i want to disable access log as we are hitting I/O Limit. Since we don’t use this access log for anything now, there is no point keep writing it to a file. To disable, you need to add following to server entry for your web site. access_log off; Here … Read more

Enable Directory Listing in Nginx

To enable directory listing in Nginx, add following to server configuration. autoindex on; Example server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; autoindex on; index index.php index.html index.htm; server_name _; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; proxy_read_timeout 600; fastcgi_read_timeout 600; fastcgi_send_timeout 600; fastcgi_intercept_errors on; fastcgi_buffers … Read more

Nginx Configuration for Video Streaming With Secure Link

here is nginx configuration i used for a video site that have secure link. server { listen 188.40.131.92:80; server_name s1.video.bizhat.com; access_log /var/log/nginx/s1.video.bizhat.com.log; error_log /var/log/nginx/s1.video.bizhat.com.error_log; location ~ ^/media/(?[\w\-=]+,\d+)(?/.*\.flv)$ { secure_link $secure; secure_link_md5 $secure_link_expires.$file.hjAGhAJKAKAHJ89AHJ00AM; if ($secure_link = “”) { return 403; } if ($secure_link = “0”) { return 410; } alias /home/s1.video.bizhat.com/private/$file; flv; } location ~ ^/media/(?[\w\-=]+,\d+)(?/.*\.mp4)$ … Read more

Nginx CloudFlare restore real ip

When using Nginx Behind Cloudflare, logs and web applications show Cloudflare sever IP instead of visitor IP. To fix this, edit Inside “http” section, add You can get updated list of CloudFlare IPs from https://www.cloudflare.com/ips Restart Nginx with Example Nginx Config https://gist.github.com/serverok/fef5c76bf96f8e016bf64095da4a64dc Back to Nginx

Disable Access to a folder in Nginx

To disable access to folder /admin in Nginx, add following to server block of your web site. location /admin { deny all; return 404; } To disable access to some common virtual control software, use location ~ /\.ht {return 404;} location ~ /\.svn/ {return 404;} location ~ /\.git/ {return 404;} location ~ /\.hg/ {return 404;} … Read more

Nginx Config for rtmp streaming

Here is nginx config used for RTMP streaming. user nginx; worker_processes 1; worker_rlimit_nofile 300000; events { worker_connections 16000; use epoll; } rtmp_auto_push on; rtmp { server { listen 25462; interleave on; wait_video on; idle_streams off; chunk_size 4096; notify_method get; application live{ live on; record off; on_play http://localhost:25461/streaming/rtmp.php; on_publish http://localhost:25461/streaming/rtmp.php; on_play_done http://localhost:25461/streaming/rtmp.php; } } } http … Read more

Nginx wildcard virtualhost

wildcard virtual host allow you to host multiple web sites with one configuration file. Here is what i use for bizhat.com free hosting sub domains. server { listen 167.114.61.119:80; server_name *.bizhat.com; autoindex on; access_log /var/log/nginx/free_access.log; error_log /var/log/nginx/free_error.log; root /home/vhosts/$host; index index.html index.htm default.htm default.html; location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires max; } location ~ … Read more

Nginx Proxy Configuration

To configure Nginx as a proxy, use the following configuration If you need to serve images using static files, add the following block to Nginx config Rule to handle SSL verification If you are proxying traffic to an application server, you may need Nginx to handle requests for SSL verification. In that case, add the … Read more