Skip to content

Instantly share code, notes, and snippets.

@benmarsh
Last active January 22, 2022 10:46
Show Gist options
  • Save benmarsh/1ad4fcbd4a873b8ac405e5520f03ad3e to your computer and use it in GitHub Desktop.
Save benmarsh/1ad4fcbd4a873b8ac405e5520f03ad3e to your computer and use it in GitHub Desktop.
Nginx + Let's Encrypt on Laravel Forge - redirect all to new domain, but allow Let's Encrypt to issue and renew

Nginx + Let's Encrypt on Laravel Forge

Redirects everything to a new domain, but allows Let's Encrypt to issue and renew certificates.

Using the inbuilt redirect in Laravel Forge appears to prevent Let's Encrypt from verifying the domain.

Example - redirect everything to example.org - edit Nginx config as below:

location / {
	# try_files $uri $uri/ /index.php?$query_string;
	
	# Redirect everything
	return 301 https://example.org/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment