Skip to content

Instantly share code, notes, and snippets.

@jesseleite
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesseleite/0947fff4a025b847e8d2 to your computer and use it in GitHub Desktop.
Save jesseleite/0947fff4a025b847e8d2 to your computer and use it in GitHub Desktop.
site setup on server example
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com/public;
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
return 444;
}
}
# For this script to work, please ensure /var/www chgrp is www-data!
# Reset /var/www
chmod -f 2750 /var/www
# Reset default site permissions.
chmod -R -f 750 /var/www
# Permission modifications for example.com.
chmod -R -f 770 /var/www/example.com/storage
# Echo message.
echo Permissions reset using /var/www/permissions.sh
#!/bin/bash
# Deploy files.
git --work-tree=/var/www/example.com --git-dir=/var/repo/example.git checkout -f
# Post deploy workflow.
cd /var/www/example.com
composer install
bash /var/www/permissions.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment