Skip to content

Instantly share code, notes, and snippets.

@aegyed91
Created January 23, 2017 19:25
Show Gist options
  • Save aegyed91/19f44d9323bb20bf426f5c2ffca697f8 to your computer and use it in GitHub Desktop.
Save aegyed91/19f44d9323bb20bf426f5c2ffca697f8 to your computer and use it in GitHub Desktop.
webpack.. the other way around
upstream webpack_dev_server {
server 127.0.0.1:4200;
}
server {
listen 443 ssl default_server http2;
ssl_certificate ...;
ssl_certificate_key ...;
root ...;
etag on;
gzip on;
client_max_body_size 100M;
location ~ ^(/sockjs-node) {
proxy_pass http://webpack_dev_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~* \.(eot|otf|ttf|woff|woff2|svg|jpg|gif|png|js|json|css)$ {
proxy_pass http://webpack_dev_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
index app_dev.php;
try_files $uri /app_dev.php$is_args$args;
}
location ~ ^/app_dev\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location ~ ^/adminer\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}
server {
listen 80 default_server;
root ...;
location / {
rewrite (.*) https://$host$request_uri;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment