Skip to content

Instantly share code, notes, and snippets.

@robabby
Forked from yacafx/default
Created November 12, 2017 04:23
Show Gist options
  • Save robabby/d11a4a4f51af035fe760e7ada1a06f45 to your computer and use it in GitHub Desktop.
Save robabby/d11a4a4f51af035fe760e7ada1a06f45 to your computer and use it in GitHub Desktop.
NGNIX configuration for run node app and php app the same same time
### /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
# This configuration is open under mydomain.com
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# This configuration is open under mydomain.com/myapp
location /myapp {
# alias /home/apps/myapp;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment