Skip to content

Instantly share code, notes, and snippets.

@NamPNQ
Last active July 5, 2019 11:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NamPNQ/caec9327c10fa7684c21 to your computer and use it in GitHub Desktop.
Save NamPNQ/caec9327c10fa7684c21 to your computer and use it in GitHub Desktop.
Symfony nginx dev config
# Store in /etc/nginx/conf.d/symfony_project.conf
server {
server_name symfony_project.localhost;
root /home/Workspace/symfony_project/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app_dev.php$is_args$args;
}
# DEV
# This rule should only be placed on your development environment
# In production, don't include this and don't deploy app_dev.php or config.php
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm-symfony_project.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# 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;
}
error_log /var/log/nginx/symfony_project_error.log;
access_log /var/log/nginx/symfony_project_access.log;
}
# Store in /etc/php5/fpm/pool.d/symfony_project.conf
[symfony_project]
user = dev_user
group = dev_group
listen = /var/run/php5-fpm-symfony_project.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
php_admin_value[open_basedir] = none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment