Skip to content

Instantly share code, notes, and snippets.

@PresleyHank
Forked from danielpereirabp/nginx-proxy
Created March 27, 2019 05:08
Show Gist options
  • Select an option

  • Save PresleyHank/6b08076b7f4aa9f1e6ff065bbe58c680 to your computer and use it in GitHub Desktop.

Select an option

Save PresleyHank/6b08076b7f4aa9f1e6ff065bbe58c680 to your computer and use it in GitHub Desktop.

Revisions

  1. @danielpereirabp danielpereirabp created this gist Jun 22, 2018.
    19 changes: 19 additions & 0 deletions nginx-proxy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    server {
    listen 80;

    server_name domain.com.br;

    location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://127.0.0.1:8181;
    }

    location ~ ^/(admin|api) {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://127.0.0.1:8282;
    }
    }
    27 changes: 27 additions & 0 deletions nginx-proxy-laravel
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    server {

    listen 8282;

    server_name localhost;
    root /var/www/vhosts/projects/nginx-proxy/laravel/public;
    index index.php;

    location / {
    try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #fixes timeouts
    fastcgi_read_timeout 600;
    include fastcgi_params;
    }

    error_log /var/log/nginx/nginx-proxy-laravel.error.log;
    access_log /var/log/nginx/nginx-proxy-laravel.access.log;
    }
    24 changes: 24 additions & 0 deletions nginx-proxy-vue
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    server {
    listen 8181;

    root /var/www/vhosts/projects/nginx-proxy/vue/dist;

    index index.html;

    server_name localhost;

    location / {
    try_files $uri $uri/ @rewrites;
    }

    location @rewrites {
    rewrite ^(.+)$ /index.html last;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    # Some basic cache-control for static files to be sent to the browser
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }
    }