So, I have a site mirror that's built with the nginx substitution module. The site itself works, but I can't seem to implement any changes to it. I have the following nginx config file for this domain:
The lines with https://example-two.com/style.css do not work. You will see them multiple places as I wasn't sure where to put them and kept trying more. I should note that I restarted nginx after each change and ensure my browser cache was cleared. I've looked high and low, but haven't found a good answer for this. Any advice appreciated.
It looks like the issue with the lines that use https://example-two.com/style.css is that they are being used in a return 301 directive. The return directive is used to return a specific HTTP status code and an optional URI to the client. It doesn't actually proxy the request to the specified URI. You could try instead using proxy_pass directive and set the header to the correct domain. Also, it is good to check the error.log file of nginx to see if there are any error messages or warnings related to the configuration.
It seems like you are trying to proxy the request to another server and change the Host header to match the new server, but it's not working. One thing you can check is that the https://example-two.com/style.css is available and reachable from the server where your nginx is running. Another thing to check is that your SSL certificate is valid and trusted by the browser. If the SSL certificate is not valid, the browser will not establish a secure connection to the server and the request will fail. Also, you can check if the example-two.com is resolving to the correct IP address and if the server is listening on the correct IP address and port. You can check these things by running a simple curl command like curl https://example-two.com/style.css from the server where nginx is running and see if it returns the expected output. Let me know if you need more help.
Considering that example-one.com has no SSL, I wouldn't think that it retrieving https://example-two.com/style.css would be an issue. Maybe I'm wrong, but I'm not getting any errors about SSL in the web browser. Any other suggestions?