nginx.conf.sample 1.59 KB
Newer Older
chimo's avatar
chimo committed
1 2
server {
  listen 80;
3 4 5 6 7 8 9 10 11 12 13 14
  listen [::]:80;

  # FIXME: change domain name here (and also make sure you do the same in the next 'server' section)
  server_name social.example.org;

  # redirect all traffic to HTTPS
  rewrite ^ https://$server_name$request_uri? permanent;
}

server {
  # Use HTTPS. Seriously. Set it up with a cert (any cert) before you run the install.
  listen 443 ssl;
chimo's avatar
chimo committed
15 16

  # Server name
17 18
  # Change "social.example.org" to your site's domain name
  server_name social.example.org;
chimo's avatar
chimo committed
19 20 21 22 23

  # SSL
  # Uncomment and change the paths to setup
  # your SSL key/cert. See https://cipherli.st/
  # for more information
24 25
  ssl_certificate       ssl/certs/social.example.org.crt;
  ssl_certificate_key   ssl/private/social.example.org.key;
chimo's avatar
chimo committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

  # Logs
  # Uncomment and change the paths to setup
  # logging
  #access_log /path/to/access.log;
  #error_log  /path/to/error.log;

  # Root
  # Change the path below to where you installed
  # GNU social
  root /path/to/gnusocial/root;

  # Index
  index index.php;

  # PHP
  location ~ \.php {
43 44 45 46 47
    include snippets/fastcgi-php.conf;

    # This should be the same value as in your (optional) /etc/php5/fpm/pool.d/$server.conf
    fastcgi_pass unix:/var/run/php5-fpm.sock;

chimo's avatar
chimo committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61
    # Remove the "fastcgi_pass" line above and uncomment
    # the one below to use TCP sockets instead of Unix sockets
    #fastcgi_pass 127.0.0.1:9000;
  }

  # Location
  location / {
    try_files $uri $uri/ @gnusocial;
  }

  # Fancy URLs
  location @gnusocial {
    rewrite ^(.*)$ /index.php?p=$1 last;
  }
62 63 64 65 66

  # Restrict access that is unnecessary anyway
  location ~ /\.(ht|git) {
    deny all;
  }
chimo's avatar
chimo committed
67 68
}