Does anyone here use MAMP Pro Nginx?
I have a working Nginx on Amazon Lightsail, but I cannot seem to get pretty urls or custom locations working in MAMP Pro.
I’m just trying to find some example files…
Does anyone here use MAMP Pro Nginx?
I have a working Nginx on Amazon Lightsail, but I cannot seem to get pretty urls or custom locations working in MAMP Pro.
I’m just trying to find some example files…
The MAMP Pro docs say that to make changes to nginx.conf you have to edit the template. It does not explain how to do that.
Is your problem more with MAMP or nginx? I can help with nginx config if you’re having trouble, but using MAMP I can’t really help with.
Thanks! The issue is with MAMP implementation of nginx, I think. I connected support in the meantime.
MAMP Templates are here:
This works on lightsail…
root sites/xandev.xanweb.app/xanApp;
# Backups
location /backups/ {
root /opt/bitnami/nginx/sites/xandev.xanweb.app/xanStorage;
include nginx_include.location.xan.conf;
}
# Files ( logs, brief, bucket, email )
location /files/ {
root /opt/bitnami/nginx/sites/xandev.xanweb.app/xanStorage;
include nginx_include.location.xan.conf;
}
# root
location / {
include nginx_include.location.xan.conf;
}
The include:
# Media
location ~* \.(?:woff2|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
add_header Permissions-Policy interest-cohort=();
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header Cache-Control "public, max-age=84600, immutable";
access_log off;
}
# js, css
location ~* \.(?:css|js|woff2|ttf)$ {
add_header Permissions-Policy interest-cohort=();
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
expires -1;
access_log off;
}
# PHP
location ~ \.php$ {
add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://js.stripe.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://secure.gravatar.com; connect-src 'self'; font-src 'self' data:; object-src 'self'; media-src 'self'; frame-src 'self' https://js.stripe.com; child-src 'self'; form-action 'self'; frame-ancestors 'none'; " always;
add_header Permissions-Policy interest-cohort=();
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
fastcgi_hide_header X-Powered-By;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_read_timeout 300;
fastcgi_pass unix:/opt/bitnami/php/var/run/www.sock;
#fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
# Other
add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://js.stripe.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://secure.gravatar.com; connect-src 'self'; font-src 'self' data:; object-src 'self'; media-src 'self'; frame-src 'self' https://js.stripe.com; child-src 'self'; form-action 'self'; frame-ancestors 'none'; " always;
add_header Permissions-Policy interest-cohort=();
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
try_files $uri $uri/ /index.php?$query_string;
I think I got “pretty urls” working! Now to get sub locations to work…
Had to set the host nginx try_files field…
Glad you got it working! I was just looking up how to work with the location directive in MAMP, and got stuck when the link in the doc for configure your nginx template file (yup, that’s the link) 404d.