Guest User

Untitled

a guest
Apr 8th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. server {
  2. listen 80 default_server;
  3. listen [::]:80 ipv6only=on default_server;
  4. server_name pretix.mydomain.com;
  5. }
  6. server {
  7. listen 443 default_server;
  8. listen [::]:443 ipv6only=on default_server;
  9. server_name pretix.mydomain.com;
  10.  
  11. ssl on;
  12. ssl_certificate /path/to/cert.chain.pem;
  13. ssl_certificate_key /path/to/key.pem;
  14.  
  15. add_header Referrer-Policy same-origin;
  16. add_header X-Content-Type-Options nosniff;
  17.  
  18. location / {
  19. proxy_pass http://localhost:8345/;
  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21. proxy_set_header X-Forwarded-Proto https;
  22. proxy_set_header Host $http_host;
  23. }
  24.  
  25. location /media/ {
  26. alias /var/pretix/data/media/;
  27. expires 7d;
  28. access_log off;
  29. }
  30.  
  31. location ^~ /media/cachedfiles {
  32. deny all;
  33. return 404;
  34. }
  35. location ^~ /media/invoices {
  36. deny all;
  37. return 404;
  38. }
  39.  
  40. location /static/ {
  41. alias /var/pretix/venv/lib/python3.5/site-packages/pretix/static.dist/;
  42. access_log off;
  43. expires 365d;
  44. add_header Cache-Control "public";
  45. }
  46. }
  47.  
  48. <VirtualHost *:80>
  49. ServerName pretix.mydomain.com
  50.  
  51. ServerAdmin webmaster@mydomain.com
  52. DocumentRoot /var/pretix
  53.  
  54. #LogLevel info ssl:warn
  55. ErrorLog ${APACHE_LOG_DIR}/error.log
  56. CustomLog ${APACHE_LOG_DIR}/access.log combined
  57.  
  58. RewriteEngine on
  59. RewriteCond %{SERVER_NAME} =pretix.mydomain.com
  60. RewriteRule ^ https://pretix.mydomain.com%{REQUEST_URI} [END,NE,R=permanent]
  61. </VirtualHost>
  62.  
  63. <IfModule mod_ssl.c>
  64. <VirtualHost _default_:443>
  65. ServerName pretix@mydomain.com
  66.  
  67. ServerAdmin webmaster@mydomain.com
  68. DocumentRoot /var/pretix
  69.  
  70. #LogLevel info ssl:warn
  71. ErrorLog ${APACHE_LOG_DIR}/error.log
  72. CustomLog ${APACHE_LOG_DIR}/access.log combined
  73.  
  74. # always redirect to tickets.gra5.de
  75. RewriteEngine on
  76. RewriteCond %{SERVER_NAME} =pretix.mydomain.com
  77. RewriteRule ^ https://pretix.mydomain.com%{REQUEST_URI} [END,NE,R=permanent]
  78.  
  79. # PROXY CONFIG
  80. ProxyPass "/" "http://localhost:8345/"
  81. ProxyPassReverse "/" "http://localhost:8345/"
  82.  
  83. # SSL Engine Switch:
  84. SSLEngine on
  85.  
  86. <FilesMatch ".(cgi|shtml|phtml|php)$">
  87. SSLOptions +StdEnvVars
  88. </FilesMatch>
  89. <Directory /usr/lib/cgi-bin>
  90. SSLOptions +StdEnvVars
  91. </Directory>
  92.  
  93. SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
  94. SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
  95. Include /etc/letsencrypt/options-ssl-apache.conf
  96. </VirtualHost>
  97. </IfModule>
  98.  
  99. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Add Comment
Please, Sign In to add comment