Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.14 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name blog.applystartup.com;
  4.     return 301 https://$server_name$request_uri;
  5. }
  6.  
  7. server {
  8.     listen 80 default_server;
  9.     server_name www.applystartup.com;
  10.     return 301 https://$server_name$request_uri;
  11.     # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
  12.         #if ($host = "applystartup.com") {
  13.         #}
  14.     #root /var/www/html/wordpress;
  15.         #index index.php index.html index.htm;
  16.  
  17.         #server_name blog.applystartup.com;
  18.  
  19.         #location / {
  20.                 # try_files $uri $uri/ =404;
  21.          #       try_files $uri $uri/ /index.php?q=$uri&$args;
  22.         #}
  23.  
  24.         #error_page 404 /404.html;
  25.  
  26.         #location ~ \.php$ {
  27.         #        try_files $uri =404;
  28.         #        fastcgi_split_path_info ^(.+\.php)(/.+)$;
  29.         #        fastcgi_pass unix:/var/run/php5-fpm.sock;
  30.         #        fastcgi_index index.php;
  31.         #        include fastcgi_params;
  32.         #}
  33.  
  34. }
  35.  
  36. server {
  37.     listen 443;
  38.     ssl on;
  39.     ssl_certificate /home/apply/applystartup.com.crt;
  40.     ssl_certificate_key /home/apply/www.applystartup.com.key;
  41.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  42.     ssl_prefer_server_ciphers on;
  43.     ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  44.     root /var/www/html/wordpress;
  45.     index index.html index.htm index.php;
  46.     server_name blog.applystartup.com;
  47.  
  48.     location / {
  49.        #try_files $uri $uri/ =404;
  50.         try_files $uri $uri/ /index.php?q=$uri&$args;
  51.     }
  52.  
  53.     error_page 404 /404.html;
  54.  
  55.     location ~ \.php$ {
  56.             try_files $uri =404;
  57.             fastcgi_split_path_info ^(.+\.php)(/.+)$;
  58.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  59.             fastcgi_index index.php;
  60.             include fastcgi_params;
  61.     }
  62. }
  63.  
  64. server {
  65.     listen 443;
  66.     ssl on;
  67.     ssl_certificate /home/apply/applystartup.com.crt;
  68.     ssl_certificate_key /home/apply/www.applystartup.com.key;
  69.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  70.     ssl_prefer_server_ciphers on;
  71.     ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  72.  
  73.     # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
  74.     #server_name www.applystartup.com;
  75.     #add_header Strict-Transport-Security max-age=15768000;
  76.    
  77.     root /var/customApps/node/applyStartup/;
  78.     index index.html index.htm index.php;
  79.     server_name applystartup.com;
  80.  
  81.     location / {
  82.         try_files $uri @prerender;
  83.         #proxy_pass http://127.0.0.1:8080;
  84.         #proxy_http_version 1.1;
  85.         #proxy_set_header Host $host;
  86.         #proxy_set_header Upgrade $http_upgrade;
  87.         #proxy_set_header Connection 'upgrade';
  88.         #proxy_cache_bypass $http_upgrade;
  89.     }
  90.  
  91.     location @prerender {
  92.         proxy_set_header X-Prerender-Token 92MfVbtg3W6X0NOLn5aQ;
  93.  
  94.         set $prerender 0;
  95.         if ($http_user_agent ~* "baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator") {
  96.             set $prerender 1;
  97.         }
  98.         if ($args ~ "_escaped_fragment_") {
  99.             set $prerender 1;
  100.         }
  101.         if ($http_user_agent ~ "Prerender") {
  102.             set $prerender 0;
  103.         }
  104.         if ($uri ~ "\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff)") {
  105.             set $prerender 0;
  106.         }
  107.  
  108.         #resolve using Google's DNS server to force DNS resolution and prevent caching of IPs
  109.         resolver 8.8.8.8;
  110.  
  111.         if ($prerender = 1) {
  112.  
  113.             #setting prerender as a variable forces DNS resolution since nginx caches IPs and doesnt play well with load balancing
  114.             set $prerender "service.prerender.io";
  115.             rewrite .* /https://$server_name$request_uri? break;
  116.             proxy_pass http://$prerender;
  117.         }
  118.         if ($prerender = 0) {
  119.             #rewrite .* /index.html break;
  120.             proxy_pass http://127.0.0.1:8080;
  121.         }
  122.     }
  123.     #resolver 8.8.8.8 8.8.4.4;
  124.     # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement