Aug 7, 2015

0 Hosting multiple Laravel apps on single Nginx server


Nginx single server configuration for multiple Laravel applications.

         

   # Nginx conf. 4 many Laravel apps

server {
  listen 80;         
  server_name kiosks;      # Change to your name.
  root /var/www/public;
  index index.html index.htm index.php;
  charset utf-8;

# Force SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

########################## Scancard app1 START ########################

location ^~ /scancard {             # scancard app1
alias /var/www/scancard/public;       # real location of scancard app1
try_files $uri $uri/ /index.php?$query_string;

  location ~ \.php$ {
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   fastcgi_pass unix:/var/run/php5-fpm.sock;
   fastcgi_param SCRIPT_FILENAME $request_filename;
   fastcgi_index index.php;
   include fastcgi_params;
}
}

########################## Scancard app1 END ##########################
# 
########################## KIOSKS app1 START ##########################

location ^~ /kiosks {          # kiosks app 2
alias /var/www/public;        # real location of kiosks app 2
try_files $uri $uri/ /index.php?$query_string;

location ~ \.php$ {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_param SCRIPT_FILENAME $request_filename;
  fastcgi_index index.php;
  include fastcgi_params;
}
}

########################## KIOSKS app2 END ############################

location / {
try_files $uri $uri/ /index.php?$query_string;
location ~ \.php$ {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_index index.php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $request_filename;
}
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }

#access_log off;
error_log  /var/log/nginx/nginx-error.log error;
error_page 404 /index.php;

location ~ /\.ht {
deny all;
}
}

0 comments :

Post a Comment

Comment: