Guest User

nginxconfig

a guest
Apr 26th, 2017
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2. listen 80;
  3. listen 443 ssl http2;
  4. server_name tusdfsdfas.com www.tusdfsdfas.com;
  5. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  6. add_header X-Frame-Options "DENY";
  7. add_header X-Content-Type-Options nosniff;
  8. add_header X-XSS-Protection "1; mode=block";
  9. ssl on;
  10. ssl_certificate /etc/ssl/ssl-bundle.crt;
  11. ssl_certificate_key /etc/ssl/private/www_tusdfsdfas_com.key;
  12. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  13. ssl_prefer_server_ciphers on;
  14. ssl_ciphers EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4;
  15. ssl_session_tickets off;
  16. ssl_session_cache shared:SSL:10m;
  17. ssl_session_timeout 10m;
  18. ssl_dhparam /etc/ssl/certs/dhparam.pem;
  19. resolver 8.8.8.8;
  20. resolver_timeout 10s;
  21. # resolver 127.0.0.1 [::1];
  22. ssl_stapling on;
  23. ssl_stapling_verify on;
  24. ssl_trusted_certificate /etc/ssl/ssl-bundle.crt;
  25.  
  26. root /var/www/html/magento-testing/;
  27. #access_log /var/log/nginx/magento-access.log;
  28. error_log /var/log/nginx/magento-errors.log debug;
  29. keepalive_timeout 70;
  30.  
  31.  
  32. # Disallow PHP scripts in /media/
  33. # Also render static 404 pages for missing media
  34. # location ~ ^/media/ {
  35. # location ~ \.php$ {
  36. # return 444;
  37. # }
  38.  
  39.  
  40. ## Gzip Static module to compress CSS, JS
  41. location ^~ /media/po_compressor/ {
  42. gzip_static on;
  43. expires 365d;
  44. add_header Pragma public;
  45. add_header Cache-Control "public, must-revalidate, max-age=31536000, proxy-revalidate";
  46. }
  47.  
  48. ## Compression
  49. gzip on;
  50. gzip_buffers 16 8k;
  51. gzip_comp_level 4;
  52. gzip_http_version 1.0;
  53. gzip_min_length 1280;
  54. gzip_types text/plain text/xml application/xml application/xml+rss image/x-icon image/bmp;
  55. gzip_vary on;
  56.  
  57.  
  58.  
  59. ####################################################################################
  60.  
  61. ## Main Magento location
  62. location / {
  63. try_files $uri $uri/ @handler;
  64. # auth_basic "Restricted";
  65. # auth_basic_user_file /var/www/html/magento/.htpasswd;
  66. expires 30d;
  67. # return 444;
  68. }
  69.  
  70. ####################################################################################
  71.  
  72. ## These locations would be hidden by .htaccess normally, protected
  73. location ~ (/(app/|includes/|/pkginfo/|var/|errors/local.xml)|/\.svn/|/.hta.+) {
  74. deny all;
  75. #internal;
  76. }
  77.  
  78.  
  79. ####################################################################################
  80.  
  81.  
  82.  
  83. ## Stop Image and Document Hijacking
  84. # location ~* (\.jpg|\.png|\.css)$ {
  85. # if ($http_referer !~ ^(http://www.tusdfsdfas.com) ) {
  86. # return 444;
  87. # }
  88.  
  89.  
  90. # This section allows you specify which IP-addresses can access your admin and downloader areas, replace 1.2.3.4 and 1.2.3.5 with your IPs.
  91.  
  92. location /downloader/ {
  93. #allow 69.221.18.45;
  94. #allow 1.2.3.5;
  95. deny all;
  96. #rewrite ^/downloader/(.*)$ /downloader/index.php$1;
  97. access_log off; #to prevent from filling up the access log file
  98. error_log off; #to prevent from filling up the error log file
  99. return 444;
  100. }
  101. #location /admin {
  102. #allow 1.2.3.4;
  103. #allow 1.2.3.5;
  104. #deny all;
  105. #rewrite / /@handler;
  106. #}
  107.  
  108. # Denied locations require a "^~" to prevent regexes (such as the PHP handler below) from matching
  109. # http://nginx.org/en/docs/http/ngx_http_core_module.html#location
  110. location ^~ /app/ { return 444; }
  111. location ^~ /sales/guest/form { return 444; }
  112. location ^~ /administrator/ { return 444; }
  113. location ^~ /wp-login.php { return 444; }
  114. location ^~ /wp-admin/ { return 444; }
  115. location ^~ /wp-content/ { return 444; }
  116. location ^~ /wordpress/ { return 444; }
  117. location ^~ /assets/ { return 444; }
  118. location ^~ /plugins/ { return 444; }
  119. location ^~ /wp/ { return 444; }
  120. location ^~ /scripts/ { return 444; }
  121. location ^~ /blog/ { return 444; }
  122. location ^~ /phpmyadmin/ { return 444; }
  123. location ^~ /backup/ { return 444; }
  124. location ^~ /backups/ { return 444; }
  125. location ^~ /admin/ { return 444; }
  126. location ^~ /includes/ { return 444; }
  127. location ^~ /media/downloadable/ { return 444; }
  128. location ^~ /pkginfo/ { return 444; }
  129. location ^~ /report/config.xml { return 444; }
  130. location ^~ /var/ { return 444; }
  131. location ^~ /lib/ { return 444; }
  132. location ^~ /dev/ { return 444; }
  133. location ^~ /rss/ { return 444; }
  134. location ^~ /RELEASE_NOTES.txt { return 444; }
  135. location ^~ /downloader/pearlib { return 444; }
  136. location ^~ /downloader/template { return 444; }
  137. location ^~ /downloader/Maged { return 444; }
  138. location ~* ^/errors/.+\.xml { return 444; }
  139.  
  140.  
  141. location /robots.txt {
  142. allow all;
  143. log_not_found off;
  144. access_log off;
  145. }
  146.  
  147. #####################################################################################
  148.  
  149.  
  150. ## Images, scripts and styles set far future Expires header
  151. location ~* \.(js|css|png|jpg|webp|jpeg|gif|ico)$ {
  152. expires max;
  153. log_not_found off;
  154. add_header Pragma public;
  155. add_header Cache-Control "max-age=31536000, public";
  156. }
  157.  
  158.  
  159. ####################################################################################
  160.  
  161.  
  162. ## Main Magento location
  163. location @handler {
  164. rewrite / /index.php;
  165. }
  166.  
  167. location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
  168. rewrite ^(.*.php)/ $1 last;
  169. }
  170.  
  171. ## Execute PHP Scripts using FastCGI
  172. # location ~ \.php(/.*)? {
  173. # if (!-e $request_filename) {
  174. # rewrite / /index.php last;
  175. # }
  176.  
  177. location ~ \.php$ {
  178. try_files $uri /index.php;
  179.  
  180.  
  181. # fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  182. expires off;
  183. fastcgi_pass 127.0.0.1:9000;
  184. fastcgi_index index.php;
  185. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  186. ## Tweak fastcgi buffers, just in case.
  187. fastcgi_buffer_size 256k;
  188. fastcgi_buffers 256 4k;
  189. fastcgi_busy_buffers_size 256k;
  190. fastcgi_temp_file_write_size 256k;
  191. #fastcgi_connect_timeout 300;
  192. #fastcgi_send_timeout 300;
  193. #fastcgi_read_timeout 300;
  194. fastcgi_param HTTPS on;
  195. fastcgi_param HTTP_SCHEME https;
  196.  
  197. include fastcgi_params;
  198. }
  199.  
  200. error_page 404 =444 /404.html;
  201.  
  202. }
RAW Paste Data