I am having issues with my xampp and locahost and laravel projects. When I create a new laravel project: composer create-project --prefer-dist laravel/laravel fmvcei in my C:/xampp/htdocs folder, when I type in localhost/fmvcei/public, nothing appears. I pulled from another stack overflow question on this where it suggested removing the NameVirtualHost *:80. When I try to configure my host files to be able to type fmvcei.test in the browser, still nothing. I have restarted xampp each time. Here are my httpd/vhost and host files:
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host.example.com
##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host2.example.com
##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
##ServerName dummy-host2.example.com
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerAdmin admin#localhost
ServerName localhost
<Directory "C:/xampp/htdocs/">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/fmvcei/public"
ServerAdmin admin#localhost
ServerName fmvcei.test
ServerAlias www.fmvcei.test
<Directory "C:/xampp/htdocs/fmvcei/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
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>
hosts file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 tbhtoat.app
127.0.0.1 fmvcei.test
First things, make sure both Apache and MySQL are running.
Move to the root project directory, fmvcei in your case, then run this command php artisan serve. you can browse by 127.0.0.1:8000
NB. you need to install composer if you don't yet.
Related
I need to add virtual host in Mac using MAMP Pro.
First step:(Edit hosts in /etc/hosts) like This
##
# 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
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
27.0.0.1 BSDs-iMac.local # added by Apache Friends XAMPP
127.0.0.1 symfony.local # MAMP PRO - Do NOT remove this entry!
::1 symfony.local # MAMP PRO - Do NOT remove this entry!
Next Step:(Open MAMP's vhosts file) and remove #
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
Next Step: (edit httpd conf)
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Desktop/avinar/my-project/public"
ServerName symfony.local
</VirtualHost>
Last Step add virtual host into mamp pro like this:
Now when I check Url: symfony.local i see this error:
>
Forbidden
>
You don't have permission to access / on this server.
When I check this url: symfony.local/my-projet/public server work and i see page.
How do fix this problem?!
That virual host may be lacking a Directory directive:
<Directory "/Desktop/avinar/my-project/public">
Options -Indexes +MultiViews +FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
If it doesn't work, recursively set apache (or however the user may be called) as the owner (or owner group) of /Desktop/avinar/my-project.
I'm using Xampp with Php and I'm trying to migrate my http website to https.
This is the tutoriel witch I'm trying to do that.
https://gist.github.com/nguyenanhtu/33aa7ffb6c36fdc110ea8624eeb51e69
Here, with the red arrow the step where I'm stuck.
Here what my file looks like.
Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host.example.com
##DocumentRoot "E:/xampp/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host2.example.com
##DocumentRoot "E:/xampp/htdocs/dummy-host2.example.com"
##ServerName dummy-host2.example.com
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "E:/eFormat/format_01\projet"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
Thanks for help.
For that step you have to edit your virtual hosts config file and add the SSL Engine on.
<VirtualHost *>
SSLEngine on
I installed latest x64 wamp server : wampserver3.1.0_x64.exe On Windows 7.
I changed it's default 80 port to 8080, because of IIS & now every thing is ok.
I added a simple project to this path : C:\wamp64\www like below :
C:\wamp64\www\php_test\index.php
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
Now when i go to this path http://localhost:8080/ > Your Projects Area >
php_test > It's link is like this > http://php_test:8080/ > That does not work & is invalid.
The true link is : http://localhost:8080/php_test
How can i fix this problem?
I found the link below for that :
Project Links do not work on Wamp Server
I followed the answer.
Now the new problem is after adding virtual hosts, phptest does not work again.
Here is httpd-vhosts.conf file :
# Virtual Hosts
#
<VirtualHost *:8080>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerName phptest
DocumentRoot "${INSTALL_DIR}/www/php_test"
<Directory "${INSTALL_DIR}/www/php_test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
I did restart all services after adding phptest to virtual hosts.
My questions :
1. How can i fix that invalid link?
2. How make virtual hosts workable?
EDIT After Comments > Here is my HOSTS file content :
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#
#
Your HOSTS file is basically empty as a # is a comment.
You have to add a reference to each VHOST into your HOSTS file like this so that the browser can find your development domains
Hosts file
127.0.0.1 localhost
::1 localhost
127.0.0.1 phptest
::1 phptest
Now you must restart the DNS Cache like this, from a command prompt that you have started "As an Administrator" or just reboot the PC
>net stop dnscache
When that has completed do
>net start dnscache
Or there is a menu item on WAMPServers menus
[Right Click] wampmanager-> Tools -> Restart DNS
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot C:/Users/user/Desktop/WebsiteDesign
ServerName testproject
<Directory "C:/Users/user/Desktop/WebsiteDesign">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I have gone to C:\xampp\apache\conf\extra\httpd-vhosts.conf and changed the values.
After making the changes I went to C:\Windows\System32\drivers\etc\host
Also following all these steps I stopped and started Apace Service from the XAMPP control panel. Still it's not working. I have also given the httpd-vhost.conf file. Can someone please guide me to configure step by step. my xampp version is 3.2.2
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry
about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##ServerAdmin webmaster#dummy-host.example.com
##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot C:/Users/user/Desktop/WebsiteDesign
ServerName testproject
<Directory "C:/Users/user/Desktop/WebsiteDesign">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I have hosted a website recently on AWS ec2 ubuntu instance. My directory structure consists of two folders:
back (consists of laravel 5.2)
front (consists of index.html,css and javascript files)
I am using laravel for the back end. Whenever I am accessing my website say
www.abc.com I am getting the default ubuntu page. So, I had to manually go to www.abc.com/front/index.html. As a workaround, I changed the Document root in /etc/apache2/sites-available/000-default.conf
from /var/www/html to /var/www/html/front. Everything works fine except for one thing - I am unable to access the back folder using the link www.abc.com/back/public.
What I think is happening would be I am now accessing www.abc.com/front/back/public.
What should be done now?
000-default.conf :
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/front
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
replace your DocumentRoot to
DocumentRoot /var/www/html/front/public
and put these inside your conf
<Directory /var/www/html/front/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>