14

I have a laravel application running through the laravel artisan server:

 php artisan serve

and it works just fine if I go on my localhost:8000.. Further, I added an inbound rule in the IIS server like so:

Control Panel -> Administrative Tools -> Windows Firewall with Advanced Security, Inbound Rules. Make a new rule "Allow Port, TCP, 8000, All profiles

However for some reason i still can't access the website from the WWW (I did the exact same steps for a webrick server (on the same machine) and things worked perfect).. any ideas?

abbood
  • 1,087
  • 3
  • 13
  • 21
  • 1
    Without knowing Laravel or `artisan`, my guess is that it's bound to `localhost` only by default and you have to configure it to handle non-local requests. Look up the docs of the system to check for this. – Sven Mar 12 '14 at 12:01
  • @SvW is correct. – ceejayoz Mar 12 '14 at 14:06

1 Answers1

30

To get it to work outside of localhost, do php artisan serve --host 0.0.0.0

If you want it to work without specifying the port in the browser, php artisan serve --host 0.0.0.0 --port 80. sudo will likely be required.

Note: php artisan serve should never be used for production. It's for dev and demonstration only and won't be able to handle more than a person or two's worth of traffic.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
  • ok sounds good.. indeed using your instructions i was able to view it from the WWW (ie mydomain.com:8080).. however i'm still wondering why i can't make apache actually serve it to the WWW? this is my specific scenario: running `artisan serve` makes it work just fine.. but then turning on apache gives me `page not found` errors.. i've created a sample laravel project using composer.. and that worked just fine even on apache.. however this project i actually copied over from another developer's machine.. i'm assuming it may have something to do with file permissions? – abbood Mar 12 '14 at 14:33
  • 2
    You're going to have to properly configure Apache to point at the right directory. See http://laravel.com/docs/installation#pretty-urls. – ceejayoz Mar 12 '14 at 14:35
  • ok.. i changed `AllowOverride` to `All` in the `httpd.conf` file in the definition of the `DocumentRoot` as instructed [here](http://stackoverflow.com/a/7859566/766570).. but that didn't work.. in the laravel website it says if that doesn't work try `Options +FollowSymLinks RewriteEngine On ..`.. but i'm not sure where to put those things? are they supposed to go to the same httpd.conf file as well? – abbood Mar 12 '14 at 14:45
  • Is your DocumentRoot pointed at the public directory? – ceejayoz Mar 12 '14 at 15:01
  • it finally worked.. indeed it was an issue of enabling `mod_Rewrite`.. i did that manually by editing the `httpd.conf` file.. but noooo! i had to click on the stupid wamp gui menu and do it there *as well*.. did i mention i hate windows? but thanks bud! – abbood Mar 12 '14 at 15:03
  • AH! Using `--host 0.0.0.0` did the trick. Thank you @ceejayoz. – colinhoernig Oct 03 '14 at 14:33
  • 1
    @colinhoernig Just remember to **never** use it for production. – ceejayoz Oct 03 '14 at 14:59
  • @ceejayoz, yes, good call, thank you for the reminder. I'm only using `artisan serve` inside of a Vagrant box for local development. – colinhoernig Oct 03 '14 at 18:32