Created
October 29, 2012 16:38
-
-
Save koenpunt/3974721 to your computer and use it in GitHub Desktop.
Quick Server Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gets the basename of the original request | |
map $request_uri $request_basename { | |
~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename; | |
} | |
# Gets the basename of the current uri | |
map $uri $basename { | |
~/(?<captured_basename>[^/]*)$ $captured_basename; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name ~^(?<domain>(www\.)?(?<project>.+)\.dev)$; | |
root /var/apps/$project/public; | |
index index.html index.php; | |
location / { | |
allow all; | |
access_log off; | |
expires 0; | |
add_header Cache-Control private; | |
try_files $uri $uri/ /index.php$is_args$args; | |
} | |
location /media { | |
autoindex on; | |
autoindex_exact_size off; | |
if ( $request_uri ~ ^/media/download/.+$ ) { | |
add_header X-Content-Type-Options nosniff; | |
add_header Content-Type "application/octet-stream"; | |
add_header Content-Disposition 'attachment; filename="$basename"'; | |
rewrite ^/media/download/(.+)$ /media/$1 last; | |
} | |
} | |
include /etc/nginx/php.conf; | |
include /etc/nginx/drop.conf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location = /robots.txt { access_log off; log_not_found off; } | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location ~ /\. { access_log off; log_not_found off; deny all; } | |
location ~ ~$ { access_log off; log_not_found off; deny all; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~ \.php$ { | |
expires off; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_index index.php; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SERVER_NAME $domain; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get update | |
apt-get install -y python-software-properties | |
# Add custom repos | |
add-apt-repository ppa:git-core/ppa | |
add-apt-repository ppa:ondrej/php5 | |
add-apt-repository ppa:nginx/stable | |
apt-get update | |
apt-get install -y ntp mysql-server mysql-client git libzend-framework-php libyaml-dev imagemagick libmagickwand-dev libmagickcore-dev memcached | |
# PHP5 Latest Stable + FPM, PEAR, dev | |
apt-get install -y php5 php5-fpm php5-dev php-pear php5-mysql php5-curl php5-intl php5-memcache | |
# Zend Framework | |
mv /etc/php5/conf.d/zend-framework.ini /etc/php5/mods-available/zend-framework.ini | |
php5enmod zend-framework | |
# libyaml + PHP-YAML | |
printf "\n" | pecl install yaml | |
echo 'Enabling PHP extension yaml' | |
echo 'extension=yaml.so' > /etc/php5/mods-available/yaml.ini | |
php5enmod yaml | |
# ImageMagick + php5-imagick | |
printf "\n" | pecl install imagick-3.1.0RC2 | |
echo 'Enabling PHP extension imagick' | |
echo 'extension=imagick.so' > /etc/php5/mods-available/imagick.ini | |
php5enmod imagick | |
# PHP-OAuth | |
pecl install oauth | |
echo 'Enabling PHP extension oauth' | |
echo 'extension=oauth.so' > /etc/php5/mods-available/oauth.ini | |
php5enmod oauth | |
# Nginx Latest Stable | |
apt-get update | |
apt-get install -y nginx | |
service nginx restart | |
service php5-fpm restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment