简体   繁体   中英

How to open laravel website in VMWARE from local PC?

I have a laravel apps that i installed on VMWARE Redhat and using SQL Server on my local pc. I can open the website in VMWARE and it can connect to my local Sqlserver. I also can open my local website from VMWARE browser.

But how to open my laravel website on VMWARE from local pc?

in /etc/hosts, i add this line

192.168.0.154 laravel.example.com

and here is my httpd.conf

<VirtualHost *:80>
    ServerName 192.168.0.154
    ServerAlias laravel.example.com
    DocumentRoot /var/www/xxx/public
    Redirect permanent / https://192.168.0.154
   <Directory /var/www/xxx/public>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
   </Directory>
<VirtualHost _default_:443>
    ServerName 192.168.0.154
    ServerAlias laravel.example.com
    ServerAdmin admin@laravel.example.com
    DocumentRoot /var/www/xxx/public
    SSLEngine on
    SSLCertificateFile "/etc/pki/tls/certs/laravel.example.com-selfsigned.crt"
    SSLCertificateKeyFile "/etc/pki/tls/private/laravel.example.com-selfsigned.key"
    Header always set Strict-Transport-Security "max-age=31536000;  includeSubDomains"

i already run php artisans serve using port 80/8080/433, and open the website in local pc with url http://laravel.example.com:port/ and still get error

php artisan serve --host laravel.example.com --port 8080

Do you have some log on your web server when you try to connect on it? If so, you will get more information that might help you to solve your problem.

Did you add 192.168.0.154 laravel.example.com on your local PC too? It's necessary.

You can check if the firewall on your VM doesn't block your connection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM