Skip to content

Instantly share code, notes, and snippets.

@pokap
Created July 15, 2015 22:15
Show Gist options
  • Save pokap/be9f6915538f5e6108a7 to your computer and use it in GitHub Desktop.
Save pokap/be9f6915538f5e6108a7 to your computer and use it in GitHub Desktop.
Symfony2 nginx+hhvm config
server {
server_name localhost;
listen 8080;
root /my/relative/project/web;
access_log /var/log/nginx/my_project.access.log;
error_log /var/log/nginx/my_project.error.log;
include /etc/nginx/symfony_default.conf;
}
listen 80;
server_tokens off;
location ~ \.php$ {
if ($uri ~ "^(.+\.php)($|/$)") {
set $script $1;
}
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param SERVER_PORT 80;
fastcgi_next_upstream off;
}
location / {
try_files $uri @php;
port_in_redirect off;
}
location @php {
set $script "/app.php";
if ($uri ~ "^(.+\.php)($|/$)") {
set $script $1;
}
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param SERVER_PORT 80;
fastcgi_next_upstream off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment