Skip to content

Instantly share code, notes, and snippets.

@richardcalahan
Last active September 21, 2023 13:49
Show Gist options
  • Save richardcalahan/2ae9522a04ec8f27a20f1e63cae27627 to your computer and use it in GitHub Desktop.
Save richardcalahan/2ae9522a04ec8f27a20f1e63cae27627 to your computer and use it in GitHub Desktop.
lakeandskye.test
server {
listen 80;
server_name api.lakeandskye.test;
return 301 https://api.lakeandskye.test$request_uri;
}
server {
listen 80;
server_name cms.lakeandskye.test;
return 301 https://cms.lakeandskye.test$request_uri;
}
server {
listen 443 ssl;
ssl_certificate ssl/_wildcard.lakeandskye.test.pem;
ssl_certificate_key ssl/_wildcard.lakeandskye.test-key.pem;
index index.php index.html index.htm;
server_name api.lakeandskye.test cms.lakeandskye.test;
if ( $host ~ 'cms' ) {
set $root 'cms';
}
if ( $host ~ 'api' ) {
set $root 'api';
}
root [PATH/TO/PROJECT]/craft/$root;
client_max_body_size 30m;
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.*) /index.php?p=$1 last;
}
error_page 404 /404.html;error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PATCH, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
add_header 'Access-Control-Allow-Credentials' true;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment