Symfony2 Nginx Docker Deploy Script

Published on

#!/bin/bash COMPOSER_EXEC=/usr/local/bin/composer PHP_EXEC=/usr/bin/php WWW_DOC_ROOT=/var/www/production STAGING_DOC_ROOT=/var/www/staging die () { echo >&2 “$@” exit 1 } [ “$#” -eq 1 ] || die “Please provide a website name (folder) to deploy.” if echo “$1” | grep ‘staging’; then DOC_ROOT=$STAGING_DOC_ROOT/$1 else DOC_ROOT=$WWW_DOC_ROOT/$1 fi if [ ! -d “$DOC_ROOT” ]; then die “The specified directory ($DOC_ROOT) does not exist.” … Continue reading Symfony2 Nginx Docker Deploy Script

Symphony2 Nginx Deploy Script

Published on

#!/bin/bash COMPOSER_EXEC=/usr/local/bin/composer PHP_EXEC=/usr/bin/php WWW_DOC_ROOT=/var/www/production STAGING_DOC_ROOT=/var/www/staging die () { echo >&2 “$@” exit 1 } [ “$#” -eq 1 ] || die “Please provide a website name (folder) to deploy.” if echo “$1” | grep ‘staging’; then DOC_ROOT=$STAGING_DOC_ROOT/$1 else DOC_ROOT=$WWW_DOC_ROOT/$1 fi if [ ! -d “$DOC_ROOT” ]; then die “The specified directory ($DOC_ROOT) does not exist.” … Continue reading Symphony2 Nginx Deploy Script

Symfony2 setfacl Commands for Nginx

Published on

Since Nginx does not support chmod +a you will need to run setfacl to give the app/cache, app/logs and other directories the proper permissions. sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs web/sitemaps sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs web/sitemaps Reference: See the Setting up Permissions section in the Installing and … Continue reading Symfony2 setfacl Commands for Nginx

Symfony2 .gitignore Sample File

Published on

/web/bundles/ /app/bootstrap.php.cache /app/cache/* /app/config/parameters.yml /app/config/parameters_dev.yml /app/logs/* !app/cache/.gitkeep !app/logs/.gitkeep /build/ /vendor/ /bin/ /.idea/ /web/css/ /web/js/ /web/apc.php /app/spool/*

Symfony2 Nginx Configuration File

Published on

server { listen 80; server_name PROJECT_DOMAIN; root /www/PROJECT_DOMAIN/web; # strip app.php/ prefix if it is present rewrite ^/app_dev\.php/?(.*)$ /$1 permanent; client_max_body_size 50m; location / { index app_dev.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app_dev.php/$1 last; } # pass the PHP scripts to FastCGI server from upstream phpfcgi location ~ ^/(app|app_dev|app_staging|config)\.php(/|$) { fastcgi_pass … Continue reading Symfony2 Nginx Configuration File

Nginx Symfony2 Server Configuration

Published on

server { listen 80; #listen [::]:80 default_server ipv6only=on;root /usr/share/nginx/html; #index index.php index.html index.htm; server_name DOMAIN_NAME; root /var/www/SITE_DIRECTORY/web; # strip app.php/ prefix if it is present rewrite ^/app_dev\.php/?(.*)$ /$1 permanent; client_max_body_size 50m; location / { index app_dev.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app_dev.php/$1 last; } # pass the PHP scripts to FastCGI … Continue reading Nginx Symfony2 Server Configuration