am_
am_

Reputation: 39

Using browsersync with XAMPP

I use XAMPP as an Apache Server and as described here https://www.browsersync.io/docs/options#option-proxy i do the following in gulp:

 browserSync.init({
    proxy: "localhost/mysite.de/DEV_F3/public_html",  
 });

But BS opens my browser at "localhost:3000/mysite.de/DEV_F3/public_html" which gives me a 404. Why does it add that port 3000 and how do I get this to simply work?

Upvotes: 1

Views: 7905

Answers (3)

Renato Lazaro
Renato Lazaro

Reputation: 177

Check your Xampp port, because if for some reason you have changed the default Xampp port, you need to put the new port of your Xampp. Another part that you can check is also your Virtual Hosts and Hosts this if you are using Windows OS.

Directories:

C:\xampp\apache\conf\extra -> httpd-vhosts.conf
C:\Windows\System32\drivers\etc -> hots

After checking these settings you can use browsersync following the official documentation.

Come on, go to your gulpfile.js

browserSync.init({
    proxy: "localhost:8080/mysite.de/DEV_F3/public_html",  
 });

When running your on your terminal you will have this return on your browser

gulp watch

Location:

Local:http://localhost:3000/mysite.de/DEV_F3/public_html

I hope it has helped or directed you to a greater understanding.

Upvotes: 1

Byron Wong
Byron Wong

Reputation: 155

For your gulpfile.js you may change the following line to include your XAMPP port:

 browserSync.init({
    proxy: "localhost/mysite.de/DEV_F3/public_html",
    port: 8000  
 });

so that when gulp initiates, it will run

localhost:8000/mysite.de/DEV_F3/public_html in the browser instead of

localhost:3000/mysite.de/DEV_F3/public_html

Note: The port is either 8000 or 8080, depending on your config.

Hope it helps

Upvotes: 3

Neil
Neil

Reputation: 42

Try using

browserSync.init({
    proxy: "localhost/mysite.de"
    online: true  
 });

This is assuming that 'mysite.de' is the root directory of your site. The 'online' part supposedly helps with performance.

Upvotes: 0

Related Questions