How to setup HTTPS URL on local project using ngrok?

I have one project and need to this project url with https.

Anyone know let me know.


2 Answers 2


Here is the all steps how to connect your local project with https.

Step 1:- Create your account in https://ngrok.com/signup

Step 2:- Install ngrok in your local system below command:-

curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
  sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
  echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
  sudo tee /etc/apt/sources.list.d/ngrok.list && \
  sudo apt update && sudo apt install ngrok

Step 3:- You can test everything is working by running ngrok -h

enter image description here

Step 4:- Go to your ngrok account and then go to Your Authtoken section and copy token.

enter image description here

After then get token you run below command.

ngrok config add-authtoken TOKEN

Setp 5:- Start ngrok using below command

ngrok http 80

You should see something similar to the following console UI in your terminal.

enter image description here

So now this your URL :- https://84c5df439d74.ngrok.io

Now your ngrok step done. Now we need setup URL in magento side as per below steps.

Step 1:- Go to your hosts file below command and url.

sudo nano /etc/hosts

enter image description here

Step 2:- After then you setup URL in hosts you need to update your project URL using below commands.

UPDATE `core_config_data` SET `value` = 'https://84c5df439d74.ngrok.io/mage245/pub/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'https://84c5df439d74.ngrok.io/mage245/pub/' WHERE `core_config_data`.`path` = 'web/secure/base_url';
UPDATE `core_config_data` SET `value` = 'https://84c5df439d74.ngrok.io/mage245/pub/' WHERE `core_config_data`.`path` = 'web/unsecure/base_link_url';
UPDATE `core_config_data` SET `value` = 'https://84c5df439d74.ngrok.io/mage245/pub/' WHERE `core_config_data`.`path` = 'web/secure/base_link_url';

Now configuration done you need run magento necessary commands.

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:f


enter image description here

Let me know if any query.



To set up HTTPS URL on your local project using ngrok, follow these steps:

  1. Download and install ngrok from the official website.

  2. Open a terminal or command prompt and navigate to the directory where you installed ngrok.

  3. Start ngrok by running the following command:

    ngrok http [port]

Replace [port] with the port number your local project is running on. For example, if your local project is running on port 8000, the command should be:

   ngrok http 8000
  1. Once ngrok is running, it will generate a public HTTPS URL that you can use to access your local project. The URL will look something like this:

  2. Update your local project's configuration to use the ngrok URL with HTTPS instead of the local URL. This will depend on your specific project and how it is set up.

For example, if your project is a PHP application using Apache, you would need to update the DocumentRoot and ServerName directives in your Apache configuration file to use the ngrok HTTPS URL:

    <VirtualHost *:80>
        DocumentRoot "/path/to/project"
        ServerName [randomstring].ngrok.io

    <VirtualHost *:443>
        DocumentRoot "/path/to/project"
        ServerName [randomstring].ngrok.io
        SSLEngine on
        SSLCertificateFile "/path/to/cert.pem"
        SSLCertificateKeyFile "/path/to/key.pem"

Replace /path/to/project with the path to your local project and /path/to/cert.pem and /path/to/key.pem with the paths to your SSL certificate and key files, respectively.

  1. Save your changes to the configuration file and restart Apache to apply the changes.
  2. Access your local project using the ngrok HTTPS URL in a web browser to verify that it is working properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.