Laravel - created virtual host, however website will not connect to localhost - php

I am desperate for help. I am new to mac and Laravel. I have just installed a fresh project and Laravel and i am trying to create the virtual host, my code:
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot “/Applications/XAMPP/htdocs”
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot “/Applications/XAMPP/htdocs/learninghub/public”
ServerName learninghub.local
</VirtualHost>
hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 learninghub.local
Getting the following error -
Object not found! The requested URL was not found on this server. If
you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.41 (Unix) OpenSSL/1.1.1c PHP/7.3.9
mod_perl/2.0.8-dev Perl/v5.16.3
Any help is greatly appreciated.
Referring to homebrew
Error: Failure while executing; git clone
https://github.com/Homebrew/homebrew-core
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core exited with
128.

Try with this:
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/htdocs/learninghub/public"
ServerName learninghub.local
ServerAlias *.learninghub.local
<Directory "/Applications/XAMPP/htdocs/learninghub/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

If you are on a Mac, I would highly suggest using Laravel Valet instead. Its a very compact development environment that uses Nginx and dnsmasq to serve your local projects with pretty URLs (*.test).
With Valet, you really don't have to fiddle with virtual hosts or edit your hosts file. You just add the directory where your projects live to Valet, and it will automagically serve them.

Related

XAMPP new VH replaces localhost?

I am trying to create a new virtual host for one of my domains. I use XAMPP as my local test environment, and in the htdocs folder i have a folder with me website.
So i have this structure:
htdocs/mysite
I wanna be able to create a virtual host for mysite. So i have done the following:
httpd-hosts in apache
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/mySite"
ServerName mySite.test
ServerAlias *.mySite.test
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs/mySite"
ServerName mySite.test
ServerAlias *.mySite.test
SSLEngine on
SSLCertificateFile "crt/mySite.test/server.crt"
SSLCertificateKeyFile "crt/mySite.test/server.key"
</VirtualHost>
I also installed an SSL certificate, but that is not my issue.
Then i changed the:
host file
127.0.0.1 mySite.test
So i restart everything, and this happens:
i try to go to mySite.test => Does NOT work, cannot find it.
If i go to mySite.test.localhost => it works.
Maybe this is working as intended? However, the weird issue is then that i cannot access my "regular" localhost anymore. If i try to go to localhost/dashboard to get the default dashboard, it goes to mySite again?
So it is like what i have done have completely "replaced" the localhost somehow? Yet, i always have to include it in my url adress, i cannot just say mySite.test?
I am pretty new to do virtual hosts, so please let me know what i am missing here.
thanks all

Xampp phpmyadmin provides endless redirect error

My Apache and MySQL instance starts up fine. For some reason, when I attempt to browse to phpmyadmin
I am redirected to
http://localhost:8081/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/https:--localhost/phpmyadmin/
I am sure where to look and the only thing I can think of is that I was trying to add a free SSL certificate to my localhost but it never worked.
This is my current settings.
httpd.conf
Listen 8081
ServerName localhost:8081
httpd-ssl.conf
Listen 8081
ServerName localhost:8081
<VirtualHost _default_:8081>
# General setup for the virtual host
DocumentRoot "C:/xampp/htdocs"
#ServerName www.example.com:8081
ServerName localhost:8081
With the code above I get endless redirections
but changing it to
Listen 4433
ServerName localhost:4433
<VirtualHost _default_:4433>
# General setup for the virtual host
DocumentRoot "C:/xampp/htdocs"
ServerName localhost:4433
doesnt let my apache server start.
Appreciate it if I could get any insight regarding this.
REgards

Virtual Host on Xampp for Laravel is not working

Hello i am learning Laravel and trying to modifying vhost file of my xampp server for laravel practice project, but its not working.
code of vhost file is
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/laravel5Prc/public"
ServerAdmin admin#localhost
ServerName laravel5.prc
ServerAlias laravel5.prc
<Directory "D:/xampp/htdocs/laravel5Prc/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
# if you want access from other pc's on your local network
#Require ip 192.168.1.121
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>
i have taken this code from this url
How to enable Virtual Host on Xampp for Laravel?
its not working form me, anyone please guide me what am i doing wrong in it ?
I'm strongly recommend you to use Laravel's vagrant box called Homestead instead of xampp, it's really amazing! You can read about it here. It's much more flexible and easier to understand than anything else.
I was using php-7.3.2 and had similar problem. This is not the solution to the problem, but an alternative. I went back to php-7.1.25 and ran again. I'm still going to check out what the problem is with version 7.3 and laravel, but maybe this will help some people who come here with the same problem.
This is what you should do, add or uncomment this below at the top of the xampp vhost file
NameVirtualHost *:80
Change this to you valid assumed domain and add the Directory index
ServerName laravel5.test
ServerAlias laravel5.test
DirectoryIndex index.php
And then go to the this folder C:\Windows\System32\drivers\etc\hosts in windows and add your domain of choice for example see this below
127.0.0.2 laravel5.test
127.0.0.3 anotherdomain.test
**** Please note don't use the localhost or 127.0.0.1 created by default to set yours's
you should create you own e.g. (127.0.0.2, 127.0.0.3, 127.0.0.4) in that order
After then restart you xampp server you should be good to go
**** I notice your Document and Directory has this "D:/xampp/htdocs/laravel5Prc/public"
change the D to C and please I would advise your laravel project should be outside the xampp folder, you can use the Document folder for this.
//Open C:\Windows\System32\drivers\etc\hosts
127.0.0.1 laravel5.prc
//Open xampp/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "C:/xampp/htdocs/laravel5Prc/public"
ServerName laravel5.prc
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/d`enter code here`ummy-host2.example.com-access.log" common
</VirtualHost>
why you don't use
php artisan serve
to run laravel on localhost.
from https://laravel.com/docs/5.4/

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"

Error 404 squirrelmail-1.4.22

I am new to squirrelmail. I am trying to configure a mail server on a linux machine which I installed apache, php, and dovecot.
I installed squirrelmail from the source code in /var/www/webmail/
I configured a virtual host:
<VirtualHost *:80>
ServerName webmail.my.domain.com
ServerAlias webmail
DocumentRoot /var/www/webmail
<Directory "/var/www/webmail">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I set the Domain under "Server Settings" in the config file to webmail.my.domain.com.
when I try to do a configtest.php in browser: webmail.my.domain.com/src/configtest.php
I get this error: 404 Not Found
The requested URL /src/configtest.php was not found on this server.
I am not sure how to get past this error. Any help would be appreciated.
Thanks.

Categories