Skip to content

Instantly share code, notes, and snippets.

@risyasin
Created July 26, 2014 09:59
Show Gist options
  • Save risyasin/9a1b547d0db4cdf03420 to your computer and use it in GitHub Desktop.
Save risyasin/9a1b547d0db4cdf03420 to your computer and use it in GitHub Desktop.
Nginx php alongside nodejs
server {
listen 80;
root /var/www/path-to-your-project;
index index.html index.htm;
server_name _ localhost;
location / {
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
location ~ \.php$ {
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_read_timeout 600;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# pass to php engine
fastcgi_pass 127.0.0.1:9000;
}
location ~ \.node$ {
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
try_files $uri = 404;
# pass to node express app
fastcgi_pass 127.0.0.1:8080;
}
location ~ /Icon {
deny all;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment