Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Following config was mostly copied from instructions given in the following Q/A:
  2. https://stackoverflow.com/questions/34755791/apache-mod-session-dbd-anyone-got-it-to-work
  3.  
  4. Ubuntu 16.04
  5. Server version: Apache/2.4.18 (Ubuntu)
  6. Server built: 2019-04-03T13:34:47
  7.  
  8.  
  9.  
  10. #-------------------------- DBD configuration ----------------------------------------------------------
  11. DBDriver mysql
  12. DBDParams "host=localhost,user=localuser,dbname=session_database,pass=password"
  13.  
  14. DBDPrepareSQL "delete from web_sessions where uuid = %s" deletesession
  15. DBDPrepareSQL "SELECT session FROM web_sessions WHERE uuid = %s AND ('expiry' = 0 OR 'expiry' > %lld)" selectsession
  16. DBDPrepareSQL "DELETE FROM web_sessions WHERE expiry != 0 AND expiry < %lld" cleansession
  17.  
  18. # next two are deliberately made to do nothing regarding update or insert, as php will take care of that part.
  19. DBDPrepareSQL "select %s, %lld, %s, %s " updatesession
  20. DBDPrepareSQL "select %s, %lld, %s" insertsession
  21.  
  22. <Directory "/var/www/html/example/unprotected/">
  23.  
  24. #The following sets the uuid cookie if it hasn't already been set.
  25. <If "%{HTTP_COOKIE} !~ /uuid/">
  26. Session on
  27. SessionDBDCookieName uuid
  28. </If>
  29.  
  30. Options Indexes FollowSymLinks
  31. AllowOverride all
  32. Require all granted
  33.  
  34. </Directory>
  35.  
  36. <Directory "/var/www/html/test/protected/">
  37.  
  38. AuthFormProvider dbd
  39.  
  40. Options FollowSymLinks
  41. AllowOverride all
  42. AuthType form
  43. AuthName "example"
  44. AuthFormProvider dbd
  45. AuthDBDUserPWQuery "SELECT session_pw FROM web_sessions WHERE uuid = %s and expiry>unix_timestamp()*1000000"
  46. Require valid-user
  47.  
  48. </Directory>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement