Last active
March 9, 2018 11:33
-
-
Save florentdestremau/c592a78a0b5e711d2d35f0a9874db11a to your computer and use it in GitHub Desktop.
Sample nanobox configuration for a PHP symfony website with node dependencies
This file contains hidden or 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
run.config: | |
cache_dirs: | |
- vendor | |
- node_modules | |
engine: php | |
engine.config: | |
runtime: php-7.1 | |
extensions: | |
- pdo_pgsql | |
- bcmath | |
- intl | |
- xml | |
- gd | |
- xmlwriter | |
- ctype | |
- curl | |
- dom | |
- iconv | |
- mbstring | |
- pdo | |
- session | |
- simplexml | |
- tokenizer | |
- xml | |
- zlib | |
- zip | |
- sockets | |
zend_extensions: | |
- opcache | |
dev_zend_extensions: | |
add: | |
- xdebug | |
rm: | |
- opcache | |
webserver: nginx | |
document_root: web | |
nginx_default_gateway: app.php | |
extra_packages: | |
- nodejs | |
extra_steps: | |
- cp devops/xdebug.ini /data/etc/php.dev.d/xdebug.ini | |
- cp devops/nginx.conf /data/etc/nginx/nginx.conf | |
- yarn install | |
deploy.config: | |
extra_steps: | |
- yarn encore production | |
before_live: | |
web.main: | |
- bin/console doctrine:migrations:migrate -n | |
web.main: | |
start: | |
php: start-php | |
apache: start-nginx | |
writable_dirs: | |
- var | |
- web | |
network_dirs: | |
data.uploads: | |
- web/uploads | |
data.cache: | |
- web/media/cache | |
log_watch: | |
dev: var/logs/dev.log | |
prod: var/logs/prod.log | |
data.uploads: | |
image: nanobox/unfs:0.9 | |
data.cache: | |
image: nanobox/unfs:0.9 | |
data.db: | |
image: nanobox/postgresql:9.6 | |
local_only: true |
This file contains hidden or 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
worker_processes 4; | |
daemon off; | |
error_log /data/var/log/nginx/error.log; | |
pid /data/var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /data/etc/nginx/mime.types; | |
default_type text/plain; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /data/var/log/nginx/access.log main; | |
client_body_temp_path /data/var/tmp/nginx/client_body_temp; | |
sendfile on; | |
keepalive_timeout 15; | |
gzip on; | |
gzip_min_length 1000; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/xml text/css application/x-javascript application/javascript; | |
server { | |
listen 8080; | |
port_in_redirect off; | |
server_name localhost; | |
root /app/web; | |
location / { | |
# try to serve file directly, fallback to app.php | |
try_files $uri /app.php$is_args$args; | |
} | |
location ~ ^/app\.php(/|$) { | |
fastcgi_pass unix:/data/var/tmp/php.sock; | |
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
include fastcgi_params; | |
# optionally set the value of the environment variables used in the application | |
# fastcgi_param APP_ENV prod; | |
# fastcgi_param APP_SECRET <app-secret-id>; | |
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name"; | |
# When you are using symlinks to link the document root to the | |
# current version of your application, you should pass the real | |
# application path instead of the path to the symlink to PHP | |
# FPM. | |
# Otherwise, PHP's OPcache may not properly detect changes to | |
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | |
# for more information). | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
fastcgi_param DOCUMENT_ROOT $realpath_root; | |
# Prevents URIs that include the front controller. This will 404: | |
# http://domain.tld/app.php/some-path | |
# Remove the internal directive to allow URIs like this | |
internal; | |
} | |
# return 404 for all other php files not matching the front controller | |
# this prevents access to other php files you don't want to be accessible. | |
location ~ \.php$ { | |
return 404; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
location ~ /\.ht { | |
deny all; | |
} | |
try_files $uri app.html app.php app.php; | |
} | |
} |
This file contains hidden or 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
xdebug.remote_enable=1 | |
xdebug.remote_connect_back=1 | |
xdebug.remote_port=9000 | |
xdebug.remote_handler=dbgp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment