How to open laravel website in VMWARE from local PC? - php

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.

Related

A very strange issue, can not access to Localhost with WAMP after windows10 automatic upgrade

I got a very strange problem with the WAMP yesterday after windows automatic upgrade.
My WAMP started successfully, the icon is green
Screenshot 1
Screenshot2
Port 80 is used by httpd.exe.
Screenshot 3
Hosts file point localhost to 127.0.0.1 and::1
httpd.conf file
Listen [::1]:80
Listen 127.0.0.1:80
httpd-vhosts.conf file
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
I am using the WAMP Version 3.1.3 - 32bit
Windows 10
No Skype, No iis in my laptop
Everything looks fine, but just can not access to localhost and localhost/PHPMyAdmin and other sub virtual domains
I just can access the login page of localhost, can not access phpinfo neither, I used this more than one year, but happend yesterday.
Who can help me...........

Accessing php file from remote host

I've a host running with centos 7 minimal in which I have set up apache server running php inside docker. My apache-config.conf file looks like :-
<VirtualHost xxxx.xxxx.com:80>
ServerAdmin root#xxxx.xxxx.com
DocumentRoot /var/www/dl
<Directory “/var/www/site“>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error_log
CustomLog ${APACHE_LOG_DIR}/access_log combined
</VirtualHost>
if the host name of the remote centos 7 machine is xxxx.xxxx.com, how can I access the php content in my windows machine running firefox browser?
Thanks.
Replace xxxx.xxxx.com in your apache config to localhost and try to open in browser http://localhost.

Serve Laravel app with Apache (wampserver) to access from other computers in same LAN

I need to access my Laravel app that is served with Apache (wampserver) from other computers in the same LAN.
OS: Windows 8.1
Wampserver version: 3.0.6
Apache version: 2.4.23
I can access my app from other computers by the following URL:
http://192.168.12.13/scms/public/
The following URLs also work:
http://192.168.12.13/scms/public/categories/create
But it does not work when I submit POST request from the above URL. It redirects to the following -
http://192.168.12.13/categories
And shows "Not Found". So, it does not work.
To solve the issue, I have setup virtual host for my app which works perfectly in my own computer. But I cannot access it from other computers.
My setup:
In file:
C:\wamp64\bin\apache\apache2.4.23\conf\httpd.conf
Added this line:
Listen 192.168.12.13:80
In file:
C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf
Full code:
# Virtual Hosts
# wamp
<VirtualHost *:80>
DocumentRoot "C:\wamp64\www"
ServerName localhost
</VirtualHost>
# scms
<VirtualHost *:80>
DocumentRoot "C:\wamp64\www\scms\public"
ServerName local.scms-ananta.com
<Directory "C:\wamp64\www\scms\public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
In file:
C:\Windows\System32\drivers\etc\hosts
Added the following lines:
127.0.0.1 local.scms-ananta.com
192.168.12.13 local.scms-ananta.com
With the above setup, I can perfectly work with my app using the following URL in my own computer:
http://local.scms-ananta.com
But I cannot access it from other computers on my network.
Kindly note, serving with php artisan serve will not serve my purpose. I need to serve it with Apache.
Any help is highly appreciated.
First of all editing host file will not help you while accessing from other computer unless you also edit all of those PC's host file. So it would be best to access with IP.
Now problem with your configuration is that for serving/deploying laravel website in your server you have to put public folder as your document root.
Follwoing is your configuration for localhost
# wamp
<VirtualHost *:80>
DocumentRoot "C:\wamp64\www"
ServerName localhost
</VirtualHost>
Change the documentroot to the following will solve your problem.
DocumentRoot "C:\wamp64\www\scms\public"

how to Load subdomain like subdirectory in apache?

I am working on an android application witch connect to an web api written in php.
I setup a subdomain by this configuration in my httpd-vhost conf file:
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www/Clinic"
ServerAlias Clinic.localhost
ServerName Clinic.localhost
<Directory "c:/wamp/www/Clinic">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
this setting work when I connect to that like this :
http://clinic.localhost:8080
but now I want to connect to this API from android device. there is no dns server and I must connect to this API by server IP now when I am trying to connect by this url:
http://192.168.1.102:8080/clinic
I get 404 error and my system cannot resolve host.
I found the reason. in my httpd-vhost config file i have not a virtual host for my root and because of this apache could not recognize host root folder. I add this config to my config file and every things is ok.
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www"
ServerAlias localhost
ServerName localhost
</VirtualHost>

Oops! Google Chrome could not connect to localhost: Apache2 configuration in MacOsX (without MAMP)

I have a machine with Linux and a nother one with MacOsX: the former for web development, the latter for iOS development. I just want to start using my MacBook for web development and stop to have two machines. I dont like virtual machines.
(PS. If I can, I'll like to not install any software like MAMP)
So, ... I've activated apache2, I've defined a VirtualHost:
<VirtualHost *:80>
ServerAdmin sensorario#gmail.com
ServerName localhost
ServerAlias senso.local.com
DocumentRoot /Users/simonegentili/Development/Www
DirectoryIndex index.php
<Directory /Users/simonegentili/Development/Www>
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/localhost.error.log
LogLevel notice
CustomLog ${APACHE_LOG_DIR}/localhost.access.log combined
</VirtualHost>
And also this DocumentRoot:
DocumentRoot "/Users/simonegentili/Development/Www/"
But I see only a message like this:
Oops! Google Chrome could not connect to localhost

Categories