If you had to change your vhosts, make sure you restart apache: $ sudo service apache2 restart Enjoy Sharing your local environment! Use the arrows to move up and down the file, make your changes, and use ctrl+o to save and ctrl+x to quit. That will open it up within your terminal. To view this file, just run the following in terminal: $ sudo nano /etc/apache2/sites-available/nf Make sure you have your server alias defined in your vhosts (located in /etc/apache2/sites-available/25-random_string_nf). You will need to vagrant ssh into your vagrant environment.įrom here, you can work with ngrok just like you would outside of Vagrant. The following commands are tested and working in the PuPHPet generated Debian Wheezy 7.5 圆4 vagrant environment. I’m going to assume that you have one up and running. I won’t go into details about installing and setting up vagrant in this posdt. If you are using Vagrant for your local environment, then there are a few extra steps to getting ngrok working. Now, run ngrok and specify the server alias: $ ngrok -subdomain example 80 You should see the standard ngrok tunnel screen in your terminal. Then, on the right site, click ‘advanced’, and at the bottom you should see a text box for ‘Customized virtual host general settings’. In MAMP Pro, under the ‘hosts’ tab, select the host you want to add the ServerAlias to. Find your Apache vhosts file and find the lines where you are defining your VirtualHost and add the following line (replace ‘example’ with whatever you want to use to access your site through the ngrok tunnel): ServerAlias How to set ServerAlias in MAMP Pro Well, this isn’t an issue! Within your apache vhosts file you can update your VirtualHost definitation with a ServerAlias property. What if you have custom URLs set up thorugh your vhosts? For example, all my sites go something like v. How to use ngrok with custom local domains If this is your configuration, than you are all set to use ngrok. It’s default configuration is to work with. ![]() With it, run the following line in terminal: $ ngrok -authtoken YOUR_TOKEN_HERE 80 Once you login, you will see your authtoken. If you don’t already have one, create a free ngrok account. Authenticate your connection with your ngrok account If you don’t- congratulations! You just set up and installed ngrok. Just run the following command: $ sudo npm install -g ngrok Once it’s finished installing, try running ngrok 80 and see if you get any errors. Actually installing ngrok is really simple thanks to how powerful npm is. ![]() If you don’t have either of those, go install them and come back. ![]() If you have node installed, you should also have npm installed. To check, you can go into terminal and run node -v. Set up is usually painless, and the benefits plentiful. ![]() Ngrok is a phenomenal tool that lets you share your localhost environment to anybody. What if you could just send them your local site link and they could view your local environment from their computer, live, and right through the browser? Well… you can! ngrok to the rescue You might go over to their desk, push your unfinished code to staging, or maybe even meet up somewhere to show them the work right on your computer. What if you are working in a team environment? You have probably run into needing to quickly show a coworker (or even a client) something and get some immediate feedback. Your current workflow probably looks something like: make changes locally, push them to staging evnironment, test, push to live. Thats a perfectly good workflow. If you are developing sites, you are probably using version control & working locally (if you’re not- you should be). This one goes out to all you web developers out there. Update 5-16-2015: I wrote a new article explaining How to get VVV and ngrok working
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |