1

In Laravel 5.4 I want to create dynamically subdomain.

According to This Answer in SO I followed this instructions to do that:

First I downloaded and installed Acrylic DNS Proxy program. then I added this line at end of Acrylic Host file like this:

127.0.0.1 *.loverspay.dev loverspay.dev

And added this to httpd-vhosts in apache extra directory:

<VirtualHost *:80>
    ServerAdmin admin@localhost.com
    DocumentRoot 'd:/wamp/www/loverspay/public'
    ServerName loverspay.dev
    ServerAlias *.loverspay.dev
    <Directory 'd:/wamp/www/loverspay/public'>
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Also I changed Preferred DNS Server to 127.0.0.1 in Local Area Connection Properties.

And this is my route to control wildcard subdomain that should show main route in larvel :

Route::group(['domain' => '{account}.loverspay.dev'], function ($account) {
        Route::get('/', function ($account, $id) {
            return view('home');
        });
    });

Now after starting acrylic DNS proxy when I go to loverspay.dev all things worked find But when I want to open ahmad.loverspay.dev for example only a This site can’t be reached message shown in chrome.

Ahmad Badpey
  • 6,348
  • 16
  • 93
  • 159

1 Answers1

1

I have used Acrylic before in a project and it worked great, I can't tell what's wrong with your setup but from my project, try the following.

Ensure you have added 127.0.0.1 loverspay.dev to your etc\hosts file.

For your Acrylic Host file, add just

127.0.0.1 *.loverspay.dev

Ensure to restart Acrylic afterwards.

Then for your httpd-vhosts, update to

<VirtualHost *:80>
    ServerAdmin admin@localhost.com
    ServerName loverspay.dev
    ServerAlias *.loverspay.dev
    DocumentRoot 'd:/wamp/www/loverspay/public'
    <Directory 'd:/wamp/www/loverspay/public'>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Hope this works.

AceKYD
  • 1,100
  • 1
  • 10
  • 14