Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HamzaAlayed/491cab949991d169bb9c79b4865d71ae to your computer and use it in GitHub Desktop.
Save HamzaAlayed/491cab949991d169bb9c79b4865d71ae to your computer and use it in GitHub Desktop.
# tested on mac
server {
server_name main-app.dev;
root /var/www/projects/main/public;
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;
# sub_directory
location ^~ /sub-app {
alias /var/www/projects/sub/public;
try_files $uri $uri/ @sub;
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_read_timeout 30000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/projects/sub/public/index.php;
}
access_log off;
error_log /var/www/projects/sub/storage/log/error.log error;
}
location @sub {
rewrite /sub/(.*)$ /sub/index.php?/$1 last;
}
# end sub_directory
location / {
try_files $uri $uri/ /index.php?$query_string;
}
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/www/projects/main/storage/log/error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_read_timeout 30000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment