Nginx

Solution to random Let's Encrypt Certbot Connection refused / Invalid response Authorization Errors

Since I upgraded my Certbot from version 1.7.0 to 1.11.0, I was getting different errors with different domain names when executing certbot renew command.

When renewing webfoobar.com:

  
certbot renew --cert-name webfoobar.com --dry-run
  

I get Invalid response AuthorizationError:

Solution to Drupal 8 Redirect module causes infinite loop (ERR_TOO_MANY_REDIRECTS) in all the URLs except front page for anonymous user

When I tried to install Drupal 8 Varbase distribution and visited its sub pages as anonymous user (like Login page https://www.webfoobar.com/user/login) I get this error message in my browser:

This page isn’t working

www.webfoobar.com redirected you too many times.

Try clearing your cookies.

ERR_TOO_MANY_REDIRECTS

... and the URL changed to:

How to route external domain to router website hosted in local virtualbox web server (Windows as host OS and CentOS 7 as guest OS)

There are test scenarios that requires a development site hosted in local web server accessible via live external domain. In this article, will show how to make a development site hosted in local virtualbox web server (Windows as host OS and CentOS 7 as guest OS). Note: make sure you have full administrator access to your router and the router's WAN IP is a public IP address.

Steps:

  1. Open and configure your Vagrantfile. Add the following lines:

Solution to so many redirects error executing independent PHP script in a Drupal 8 site running under nginx

The issue is when executing a standalone PHP script in a Drupal 8 site running under nginx gets "The page isn't redirecting properly" error in Firefox and getting this error in Chrome: "This page isn't working [domain] redirected you too many times." but the PHP scripts that executes under Drupal 8 bootstrap don't get this issue. The bug must be on nginx webserver configuration. Investigating the nginx configuration file php_pass.conf that handles my Drupal 8 site PHP scripts:

Run your legacy projects in PHP 5.6 along with Laravel Valet that runs under PHP 7.2 in macOS

As of this writing, the latest Laravel Valet requires PHP 7.2. What if you still have legacy projects or Drupal 6 modules you maintain that can't run under PHP 7.2? It would be nice if Laravel Valet has option to run multiple PHP versions but there isn't one. Laravel Valet uses nginx + php-fpm and we can tap to nginx and php-fpm's configurations to make possible to run our legacy projects in PHP 5.6. This will make our nginx running both PHP 7.2 and PHP 5.6.

Workaround way to display nginx configuration error details in macOS

The Homebrew service control in macOS does not display if there is/are error(s) in your nginx configuration. For example if you mistakenly duplicate the declaration of "client_max_body_size" directive Homebrew service control won't give any error details or even tell you that there is error in your nginx configuration when you restarted the nginx service:

How to assign different separate domain for a Drupal page using Nginx

A client asked me to work on one particular page of his existing Drupal site to have its own different separate domain. This is one good solution if you have special web page that you want to quickly improve ranking on search engines.

Lets say, the http://www.webfoobar.com/node/88 is the page that we want it to have its own domain "test7.webfoobar.com". The following steps will accomplish this task:

Nginx solution to web static files are blocked by CORS policy: No 'Access-Control-Allow-Origin' header

If a website is trying to access web static files from different URL domain, broken web assets and the following error will occur:

Access to Font at 'https://www.webfoobar.com/sites/webfoobar.com/themes/custom/mybootstrap/fonts/sniper.woff?1887860575' from origin 'https://test7.webfoobar.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://test7.webfoobar.com' is therefore not allowed access.

Tags