nginx.conf.sample 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. # FIXME: change domain name here (and also make sure you do the same in the next 'server' section)
  5. server_name social.example.org;
  6. # redirect all traffic to HTTPS
  7. rewrite ^ https://$server_name$request_uri? permanent;
  8. }
  9. server {
  10. # Use HTTPS. Seriously. Set it up with a cert (any cert) before you run the install.
  11. listen 443 ssl;
  12. # Server name
  13. # Change "social.example.org" to your site's domain name
  14. server_name social.example.org;
  15. # SSL
  16. # Uncomment and change the paths to setup
  17. # your SSL key/cert. See https://cipherli.st/
  18. # for more information
  19. ssl_certificate ssl/certs/social.example.org.crt;
  20. ssl_certificate_key ssl/private/social.example.org.key;
  21. # Logs
  22. # Uncomment and change the paths to setup
  23. # logging
  24. #access_log /path/to/access.log;
  25. #error_log /path/to/error.log;
  26. # Root
  27. # Change the path below to where you installed
  28. # GNU social
  29. root /path/to/gnusocial/root;
  30. # Index
  31. index index.php;
  32. # PHP
  33. location ~ \.php {
  34. include snippets/fastcgi-php.conf;
  35. # This should be the same value as in your (optional) /etc/php5/fpm/pool.d/$server.conf
  36. fastcgi_pass unix:/var/run/php5-fpm.sock;
  37. # Remove the "fastcgi_pass" line above and uncomment
  38. # the one below to use TCP sockets instead of Unix sockets
  39. #fastcgi_pass 127.0.0.1:9000;
  40. }
  41. # Location
  42. location / {
  43. try_files $uri $uri/ @gnusocial;
  44. }
  45. # Fancy URLs
  46. location @gnusocial {
  47. rewrite ^(.*)$ /index.php?p=$1 last;
  48. }
  49. # Restrict access that is unnecessary anyway
  50. location ~ /\.(ht|git) {
  51. deny all;
  52. }
  53. }