-
-
Save tranghaviet/5d8346e462747145017e73a2986a3364 to your computer and use it in GitHub Desktop.
Nginx Proxy - SPA (Vue 2) + API/ADMIN (Laravel 5.6)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment