How to Set Up Nginx Reverse Proxy for Your Shopify Store

How to Set Up Nginx Reverse Proxy to Use with Shopify Store

Setting up a reverse proxy with Nginx for a Shopify store can greatly improve your website’s performance and security. Nginx’s reverse proxy feature allows it to handle incoming requests and direct them to the appropriate server, in this case, your Shopify store.

By using Nginx as a reverse proxy, you can cache frequently accessed resources, reduce the number of requests sent to your Shopify store, and even filter incoming requests to block harmful traffic. Additionally, using Nginx as a reverse proxy can improve the SSL/TLS negotiation process, resulting in faster page load times and a better overall user experience.

In this article, we will guide you through the steps necessary to set up Nginx as a reverse proxy for your Shopify store. We’ll cover the installation process, configuration options, and best practices to follow to ensure your website is optimized for performance and security. So let’s get started!

Prerequisites for setting up Nginx Reverse Proxy

Before you set up Nginx Reverse Proxy to use with your Shopify store, make sure that you have the following prerequisites in place:

  • Shopify plan: You need to have a Shopify plan that includes custom domains.
  • Domain name: You need to have a registered domain name that you want to use with your store.
  • Server: You need a server to host your Nginx Reverse Proxy. This server can be a dedicated server or a VPS (Virtual Private Server). You can choose any hosting provider that supports Nginx.
  • SSH access: You’ll need SSH access to your server in order to install and configure Nginx.
  • Nginx: You’ll need to have Nginx installed on your server. If you haven’t installed it yet, you can refer to the official Nginx documentation for installation instructions.
  • SSL certificate: You’ll need an SSL certificate to secure your communication with Shopify. You can obtain a free SSL certificate from Let’s Encrypt or purchase a commercial one from a certificate authority (CA).

Make sure to have all these prerequisites in place before proceeding to the next section. Once you have them, you can proceed to set up Nginx Reverse Proxy to use with your Shopify store.

Configuring Nginx Reverse Proxy with your Shopify Store

Now that you have successfully installed Nginx and created a reverse proxy, it is time to configure it with your Shopify store. Follow these steps to do so:

  1. Open the nginx.conf file with a text editor of your choice. This file is located in the /usr/local/nginx/conf/ directory.

  2. Add the following code to the http block of the nginx.conf file:

upstream backend {

Note: Replace “yourstorename” with your actual store name.

  1. Next, add the following code to the server block of your nginx.conf file to create the reverse proxy:
location / {
proxy_pass http://backend;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
  1. Save and close the nginx.conf file.

  2. Restart Nginx to apply the changes by running the following command:

sudo systemctl restart nginx

Congratulations! Your Nginx reverse proxy is now configured with your Shopify store. You can test it by entering your store’s URL in your web browser.

With the above configuration, incoming requests to your server will be directed to your Shopify store in a seamless and secure manner. Your customers will only see your domain name in the URL, hiding the actual Shopify URL from them.

Configuring Nginx reverse proxy with your Shopify store may seem complicated at first, but it is a one-time setup that will benefit you in the long run. By using reverse proxy, you can enhance security, scalability, and provide a better user experience to your customers.

Testing and Troubleshooting Nginx Reverse Proxy

After setting up the Nginx reverse proxy for your Shopify store, it’s crucial to test it to ensure that everything is working correctly. Here are some tips for testing and troubleshooting the Nginx reverse proxy:

1. Verify Nginx Configuration

It’s vital to verify the Nginx configuration manually to ensure that there are no syntax errors or incorrect settings. You can do this by running the following command:

sudo nginx -t

If there are any errors, the command will notify you, and you’ll need to fix them before proceeding.

2. Check Nginx Logs

Nginx logs can provide valuable information for troubleshooting the reverse proxy setup. Access the logs by running the command:

sudo tail -f /var/log/nginx/error.log 

This will show you the most recent Nginx error logs. You can also try accessing your Shopify store and watching the logs to see if any errors occur.

3. Test Site Availability

Once you’ve set up the Nginx reverse proxy, you should test your Shopify store’s availability. The simplest way to do this is by opening your store’s URL in a web browser. If everything is working correctly, you should see your store.

4. Test HTTPS Redirection

You must ensure that your Nginx reverse proxy redirects traffic from HTTP to HTTPS. You can test this by typing your store’s URL with HTTP in the web browser. If everything is set up correctly, you should automatically be redirected to the HTTPS version of your store.

5. Check SSL Certificate

If you’re using HTTPS with your Shopify store, you need to ensure that the SSL certificate is valid and correct. You can use online SSL checker tools to verify that the certificate is valid and issued by a trusted certificate authority.

By following the steps above, you can test and troubleshoot your Nginx reverse proxy setup to ensure that your Shopify store works correctly. Remember to keep Nginx and Shopify updated to the latest versions to avoid any compatibility issues.


Congratulations! You’ve successfully set up Nginx Reverse Proxy to use with your Shopify Store. This should improve your website’s security, help with page load speeds, and create a more streamlined user experience.

To recap, you accomplished the following steps:

  1. Installed Nginx on your server and created a backup of your original configuration file.
  2. Created a new configuration file for your Shopify Store and updated it with the necessary settings.
  3. Tested the new configuration file and made sure it was working correctly.
  4. Set up a secure SSL/TLS certificate for your website using Let’s Encrypt.
  5. Redirected all HTTP traffic to HTTPS to ensure a secure connection.

By following these steps, you’ve not only improved your website’s performance and security, but you’ve also gained knowledge in setting up Nginx Reverse Proxy for future projects.

We hope this article has been informative and helpful to you. If you have any questions, feel free to reach out to us for assistance. Thank you for choosing Nginx and Shopify for your website needs. Good luck and enjoy your optimized website!

Important links

Contact us at