Skip to content

Instantly share code, notes, and snippets.

@debojitkakoti
Last active October 14, 2016 05:06
Show Gist options
  • Save debojitkakoti/082f0997d2eb2e6b31ac34d099a7a637 to your computer and use it in GitHub Desktop.
Save debojitkakoti/082f0997d2eb2e6b31ac34d099a7a637 to your computer and use it in GitHub Desktop.
Reverse Proxy with Nginx, HHVM and PHP FPM
upstream BACKEND {
server 127.0.0.1:9000; #HHVM
server unix:/var/run/php5-fpm.sock backup; #PHP-FPM in backup mode
}
server {
listen 80;
server_name YOUR_SERVER_IP;
root /var/www/sampleapp/app/webroot/;
index index.php index.html;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.(hh|php)$ {
fastcgi_pass BACKEND;
proxy_next_upstream error timeout invalid_header http_500 http_504;
fastcgi_read_timeout 30;
fastcgi_keep_conn on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment