Skip to content

Instantly share code, notes, and snippets.

@phanngoc
Created June 26, 2018 05:24
Show Gist options
  • Save phanngoc/2100171b7518c8de07cf34778bdffc25 to your computer and use it in GitHub Desktop.
Save phanngoc/2100171b7518c8de07cf34778bdffc25 to your computer and use it in GitHub Desktop.
upstream websocket {
server 0.0.0.0:3000;
keepalive 8;
}
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;
server_name localhost;
root /var/www/public;
index index.php index.html index.htm;
location ~ ^/(node|socket\.io) {
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_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
try_files $uri $uri/ @rewrite;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment