keesschepers

nginx + mod_pagespeed + apache

Jan 3rd, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. #Make sure everything redirects to https if accessed by port 80
  2. <VirtualHost *:80>
  3. ServerAdmin "[email protected]"
  4. DocumentRoot /home/kees/sites/some-website.com/public_html
  5. ServerName some-website.com
  6. ServerAlias www.some-website.com
  7. <Directory /home/kees/sites/some-website.com/public_html>
  8. AllowOverride All
  9. Allow from All
  10. </Directory>
  11.  
  12. Redirect permanent / https://polyestershoppen.nl/
  13. </VirtualHost>
  14.  
  15. <VirtualHost *:4000>
  16. ServerAdmin "[email protected]"
  17. DocumentRoot /home/kees/sites/some-website.com/public_html
  18. ServerName some-website.com
  19. ServerAlias www.some-website.com
  20. <Directory /home/kees/sites/some-website.com/public_html>
  21. AllowOverride All
  22. Allow from all
  23. </Directory>
  24. </VirtualHost>
  25.  
  26. ## And make sure you add these somewhere in your ports.conf or any other 'global' configuration:
  27. Listen 4000
  28. NameVirtualHost *:4000
  29.  
  30. ### MOD PAGESPEED CONFIG ###
  31. <IfModule pagespeed_module>
  32. ModPagespeed on
  33. AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
  34. AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER application/xhtml+xml
  35.  
  36. ModPagespeedFileCachePath "/var/mod_pagespeed/cache/"
  37. ModPagespeedGeneratedFilePrefix "/var/mod_pagespeed/files/"
  38.  
  39. ModPagespeedAvoidRenamingIntrospectiveJavascript on
  40.  
  41. ModPagespeedEnableFilters collapse_whitespace
  42. ModPagespeedEnableFilters elide_attributes
  43. ModPagespeedEnableFilters collapse_whitespace
  44. ModPagespeedEnableFilters combine_css
  45. ModPagespeedEnableFilters combine_javascript
  46. ModPagespeedEnableFilters rewrite_css
  47. ModPagespeedEnableFilters rewrite_javascript
  48. ModPagespeedEnableFilters rewrite_images
  49. ModPagespeedEnableFilters remove_comments
  50. ModPagespeedEnableFilters insert_image_dimensions
  51. ModPagespeedEnableFilters trim_urls
  52.  
  53. ModPagespeedDisableFilters extend_cache
  54.  
  55. ModPagespeedDisallow */tiny_mce.js
  56. ModPagespeedDisallow */highchart*
  57. ModPagespeedDisallow */munin/*
  58. ModPagespeedDisallow */roundcube/*
  59.  
  60. <Location /mod_pagespeed_beacon>
  61. SetHandler mod_pagespeed_beacon
  62. </Location>
  63.  
  64. # This page lets you view statistics about the mod_pagespeed module.
  65. <Location /mod_pagespeed_statistics>
  66. Order allow,deny
  67. # You may insert other "Allow from" lines to add hosts you want to
  68. # allow to look at generated statistics. Another possibility is
  69. # to comment out the "Order" and "Allow" options from the config
  70. # file, to allow any client that can reach your server to examine
  71. # statistics. This might be appropriate in an experimental setup or
  72. # if the Apache server is protected by a reverse proxy that will
  73. # filter URLs in some fashion.
  74. Allow from localhost
  75. Allow from 127.0.0.1
  76. SetHandler mod_pagespeed_statistics
  77. </Location>
  78.  
  79. ModPagespeedMessageBufferSize 100000
  80.  
  81. <Location /mod_pagespeed_message>
  82. Allow from localhost
  83. Allow from 127.0.0.1
  84. SetHandler mod_pagespeed_message
  85. </Location>
  86. <Location /mod_pagespeed_referer_statistics>
  87. Allow from localhost
  88. Allow from 127.0.0.1
  89. SetHandler mod_pagespeed_referer_statistics
  90. </Location>
  91. </IfModule>
  92.  
  93. ### NGINX VIRTUAL HOST###
  94.  
  95. server {
  96. listen 443 ssl;
  97. server_name www.some-website.com;
  98.  
  99. ssl_certificate /etc/ssl/certs/www_some-website_com.chained.crt;
  100. ssl_certificate_key /etc/ssl/certs/www_some-website_com_nopassword.key;
  101. ssl_session_timeout 5m;
  102. ssl_protocols SSLv2 SSLv3 TLSv1;
  103.  
  104. keepalive_timeout 60;
  105.  
  106. location / {
  107. proxy_pass http://www.some-website.com:4000;
  108.  
  109. ### force timeouts if one of backend is died ##
  110. proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
  111.  
  112. ### Set headers ####
  113. proxy_set_header Host $host;
  114. proxy_set_header X-Real-IP $remote_addr;
  115. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  116.  
  117. ### Most PHP, Python, Rails, Java App can use this header ###
  118. proxy_set_header X-Forwarded-Proto https;
  119.  
  120. ### By default we don't want to redirect it ####
  121. proxy_redirect off;
  122. }
  123.  
  124. }
Advertisement
Add Comment
Please, Sign In to add comment