mercredi 12 juin 2019

Unable to login for another domain access same project & database using XAMPP in localhost

I am developing a project using laravel 5 with XAMPP as web server. I have added two domains in my windows host and apache vhost files to redirect them to one laravel project. Both domains will be in the same server once lived.

Everything was working fine when admin was using subdomain of the domain project.test(Example, admin.project.test) but after moved the admin site to another domain. I am unable to login the admin site(admin.admin.test) while the project.test domain still working fine.

I have a clue for the reason which is mostly due to the session. I have tried to change the .env variable SESSION_DOMAIN to the admin.test then I can login the admin site with no problem but this time it was the project.test site unable to login.

Below are the configuration for window hosts & apache vhost files which are working fine for your reference.

C:\Windows\System32\drivers\etc\hosts

127.0.0.1 project.test
127.0.0.1 my.project.test
127.0.0.1 sg.project.test

127.0.0.1 admin.admin.test

httpd-vhost.conf

<VirtualHost *:80>
     DocumentRoot "C:\xampp\htdocs\project-member\public"
     ServerName project.test
     ServerAlias *.project.test
</VirtualHost>
<VirtualHost *:443>
     DocumentRoot "C:\xampp\htdocs\project-member\public"
     ServerName project.test
     ServerAlias *.project.test
     SSLEngine on
     SSLCertificateFile "crt/project.test/server.crt"
     SSLCertificateKeyFile "crt/project.test/server.key"
</VirtualHost>

<VirtualHost *:80>
     DocumentRoot "C:\xampp\htdocs\project-member\public"
     ServerName admin.admin.test
     ServerAlias admin.admin.test
</VirtualHost>
<VirtualHost *:443>
     DocumentRoot "C:\xampp\htdocs\project-member\public"
     ServerName admin.admin.test
     ServerAlias admin.admin.test
     SSLEngine on
     SSLCertificateFile "crt/project.test/server.crt"
     SSLCertificateKeyFile "crt/project.test/server.key"
</VirtualHost>

What I am seeking are there any solutions for this case? What I hope to achieved was allow two different domains to access the same laravel project as well as the database. Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire