0

I developed an application with laravel and i put it in a local server and i need that other computer access it.

I think that have 2 solutions:

First: Access to laravel server (port 8000) Second: Put the project in xampp

What is the best solution?

With the first option i can't access and with xampp it doesn't access well to routes and doesn't load the css and js files. If i access to root folder it list the project folders and i have to go to public folder but doesn't load stylesheet files.

How can i do that?

UPDATE:

I did this steps and this not work yet.

In httpd.conf enable this line Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Next i add a host in in hosts file:

127.0.0.1 arquivo.localhost

Next i'm going to httpd-vhosts.conf and add this:

<VirtualHost *:8888>
  DocumentRoot "/Applications/MAMP/htdocs/arquivo/public"
  ServerAdmin arquivo.localhost
  <Directory "/Applications/MAMP/htdocs/arquivo/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
  </Directory>
</VirtualHost>

Next i restart the apache and when i try to access to http://arquivo.localhost this give me This site can’t be reached

What i'm doing wrong?

Thank you

user3242861
  • 1,839
  • 12
  • 48
  • 93

2 Answers2

0

create virtualhost under xampp/apache/conf/extra/httpd-vhost.conf like this

<VirtualHost *:80>
ServerAdmin webmaster@localhost.com
DocumentRoot "C:/xampp/htdocs/laravel/public"
ServerName laravel.localhost
ErrorLog "logs/laravel-error.log"
CustomLog "logs/laravel-access.log" common
</VirtualHost>

and access with http://laravel.localhost/

D. Pachauri
  • 244
  • 2
  • 8
  • don't forgot to restart apache after creating virtualhost – D. Pachauri Apr 05 '17 at 10:20
  • I do this and i stop and start the apache. When i put laravel.app in browser i have serve not found error. And if i go to project folder ihave the public folder but if in the browser i put localhost:81/laravel this list all project folder but the public folder doesn't show. @D.Pachauri – user3242861 Apr 05 '17 at 10:38
  • you cant access laravel app forlder directly. if you have created virtualhost exactly like above then http://laravel.localhost/ should run. – D. Pachauri Apr 05 '17 at 10:43
  • but i cannot change the server name? In my case i put laravel.app but not because folder app @D.Pachauri – user3242861 Apr 05 '17 at 10:44
  • now tell me not found. The request resource is not found. @D.Pachauri – user3242861 Apr 05 '17 at 10:47
  • i'm using port 81 but set it in virtual host. @D.Pachauri – user3242861 Apr 05 '17 at 10:50
0

If its working fine on your localhost, other person can access your site using your Ip address, provided you both are on same local network.

For more you can see this reference : Accessing localhost (xampp) from another computer over LAN network - how to?

Community
  • 1
  • 1
Pankit Gami
  • 2,523
  • 11
  • 19