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.
THANKS.
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
Step 4:- Go to your ngrok account and then go to Your Authtoken
section and copy token.
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.
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
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
OUTPUT
Let me know if any query.
THANKS.
To set up HTTPS URL on your local project using ngrok, follow these steps:
Download and install ngrok from the official website.
Open a terminal or command prompt and navigate to the directory where you installed ngrok.
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
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:
https://[randomstring].ngrok.io
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>
<VirtualHost *:443>
DocumentRoot "/path/to/project"
ServerName [randomstring].ngrok.io
SSLEngine on
SSLCertificateFile "/path/to/cert.pem"
SSLCertificateKeyFile "/path/to/key.pem"
</VirtualHost>
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.