SHARE
TWEET

Laravel + Nuxt Nginx VHost

caruzko Dec 19th, 2019 (edited) 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2.     listen 80;
  3.     listen 443 ssl http2;
  4.     server_name laranuxt.local;
  5.     #root "/home/vagrant/Code/apps/laranuxt/public";
  6.  
  7.     index index.html index.htm index.php;
  8.  
  9.     charset utf-8;
  10.  
  11.     #location / {
  12.     #    try_files $uri $uri/ /index.php?$query_string;
  13.     #}
  14.  
  15.   # proxy for frontend
  16.   location / {
  17.     # nuxt server url
  18.     proxy_pass http://localhost:3000;
  19.     proxy_http_version 1.1;
  20.     proxy_set_header Upgrade $http_upgrade;
  21.     proxy_set_header Connection 'upgrade';
  22.     proxy_set_header Host $host;
  23.     proxy_cache_bypass $http_upgrade;
  24.   }
  25.  
  26.     location /api {
  27.         alias /home/vagrant/Code/apps/laranuxt/public;
  28.         try_files $uri $uri/ @api;
  29.  
  30.         location ~ \.php$ {
  31.             include snippets/fastcgi-php.conf;
  32.             fastcgi_param SCRIPT_FILENAME $request_filename;
  33.             fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  34.         }
  35.     }
  36.  
  37.     location @api {
  38.         rewrite /api/(.*)$ /api/index.php?/$1 last;
  39.     }
  40.  
  41.     location = /favicon.ico { access_log off; log_not_found off; }
  42.     location = /robots.txt  { access_log off; log_not_found off; }
  43.  
  44.     access_log off;
  45.     error_log  /var/log/nginx/laranuxt.local-error.log error;
  46.  
  47.     sendfile off;
  48.  
  49.     client_max_body_size 100m;
  50.  
  51.     location ~ \.php$ {
  52.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  53.         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  54.         fastcgi_index index.php;
  55.         include fastcgi_params;
  56.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  57.  
  58.         fastcgi_intercept_errors off;
  59.         fastcgi_buffer_size 16k;
  60.         fastcgi_buffers 4 16k;
  61.         fastcgi_connect_timeout 300;
  62.         fastcgi_send_timeout 300;
  63.         fastcgi_read_timeout 300;
  64.     }
  65.  
  66.     location ~ /\.ht {
  67.         deny all;
  68.     }
  69.  
  70.     ssl_certificate     /etc/nginx/ssl/laranuxt.local.crt;
  71.     ssl_certificate_key /etc/nginx/ssl/laranuxt.local.key;
  72. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top