Skip to content

Instantly share code, notes, and snippets.

@aasumitro
Created February 17, 2020 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aasumitro/5a54149e2bc4d85d94373ba55590fbef to your computer and use it in GitHub Desktop.
Save aasumitro/5a54149e2bc4d85d94373ba55590fbef to your computer and use it in GitHub Desktop.
multiple subdir nginx config
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/html;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
# location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# alias /var/www/html;
# try_files $uri $uri/ =404;
# }
location ^~ /apps-eden {
alias /var/www/eden/public;
try_files $uri $uri/ @laravel;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/eden/public/index.php;
}
}
location @laravel {
rewrite /apps-eden/(.*)$ /apps-eden/index.php?/$1 last;
}
location ^~ /apps-pos {
alias /var/www/spos/public;
try_files $uri $uri/ @laravelpos;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/spos/public/index.php;
}
}
location @laravelpos {
rewrite /apps-pos/(.*)$ /apps-pos/index.php?/$1 last;
}
location / {
try_files $uri /index.html;
}
location ~ /\.(?!well-known).* {
deny all;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment