Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- server_name blog.applystartup.com;
- return 301 https://$server_name$request_uri;
- }
- server {
- listen 80 default_server;
- server_name www.applystartup.com;
- return 301 https://$server_name$request_uri;
- # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
- #if ($host = "applystartup.com") {
- #}
- #root /var/www/html/wordpress;
- #index index.php index.html index.htm;
- #server_name blog.applystartup.com;
- #location / {
- # try_files $uri $uri/ =404;
- # try_files $uri $uri/ /index.php?q=$uri&$args;
- #}
- #error_page 404 /404.html;
- #location ~ \.php$ {
- # try_files $uri =404;
- # fastcgi_split_path_info ^(.+\.php)(/.+)$;
- # fastcgi_pass unix:/var/run/php5-fpm.sock;
- # fastcgi_index index.php;
- # include fastcgi_params;
- #}
- }
- server {
- listen 443;
- ssl on;
- ssl_certificate /home/apply/applystartup.com.crt;
- ssl_certificate_key /home/apply/www.applystartup.com.key;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
- root /var/www/html/wordpress;
- index index.html index.htm index.php;
- server_name blog.applystartup.com;
- location / {
- #try_files $uri $uri/ =404;
- try_files $uri $uri/ /index.php?q=$uri&$args;
- }
- error_page 404 /404.html;
- location ~ \.php$ {
- try_files $uri =404;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- }
- }
- server {
- listen 443;
- ssl on;
- ssl_certificate /home/apply/applystartup.com.crt;
- ssl_certificate_key /home/apply/www.applystartup.com.key;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
- # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
- #server_name www.applystartup.com;
- #add_header Strict-Transport-Security max-age=15768000;
- root /var/customApps/node/applyStartup/;
- index index.html index.htm index.php;
- server_name applystartup.com;
- location / {
- try_files $uri @prerender;
- #proxy_pass http://127.0.0.1:8080;
- #proxy_http_version 1.1;
- #proxy_set_header Host $host;
- #proxy_set_header Upgrade $http_upgrade;
- #proxy_set_header Connection 'upgrade';
- #proxy_cache_bypass $http_upgrade;
- }
- location @prerender {
- proxy_set_header X-Prerender-Token 92MfVbtg3W6X0NOLn5aQ;
- set $prerender 0;
- if ($http_user_agent ~* "baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator") {
- set $prerender 1;
- }
- if ($args ~ "_escaped_fragment_") {
- set $prerender 1;
- }
- if ($http_user_agent ~ "Prerender") {
- set $prerender 0;
- }
- 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)") {
- set $prerender 0;
- }
- #resolve using Google's DNS server to force DNS resolution and prevent caching of IPs
- resolver 8.8.8.8;
- if ($prerender = 1) {
- #setting prerender as a variable forces DNS resolution since nginx caches IPs and doesnt play well with load balancing
- set $prerender "service.prerender.io";
- rewrite .* /https://$server_name$request_uri? break;
- proxy_pass http://$prerender;
- }
- if ($prerender = 0) {
- #rewrite .* /index.html break;
- proxy_pass http://127.0.0.1:8080;
- }
- }
- #resolver 8.8.8.8 8.8.4.4;
- # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement