I am very new to magento and php and i am trying to create a virtual host url for my magento site.
Currently the url is
http://localhost:8080/Magento/
And if i create any website i have to use url's such as below
http://localhost:8080/Magento/website1
http://localhost:8080/Magento/website2
...
After referring to several examples such as this http://sawmac.com/xampp/virtualhosts/ i have managed to configure my files such as below
Step 1:
In the file C:\Windows\System32\drivers\etc\hosts i have append the below mapping
127.0.0.1 clientA.local
Step 2:
And in the file C:\xampp\apache\conf\extra\httpd-vhosts.conf i have append the below code
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:\xampp\htdocs\magento"
ServerName clientA.local
<Directory "C:\xampp\htdocs\magento">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After step 1 typing typing clientA.local:8080/magento opens localhost:8080/magento
But step 2 doesn't change anything.
I want to do something as below
clientA.local should open http://localhost:8080/Magento/website1
clientB.local should open http://localhost:8080/Magento/website2
...
I have tried changing the Document root , directory in several ways nothing helped.
If any one has any idea on this senario please contribute here.
thanx
Related
I have installed wordpress on my machine. I have two direcotory for apache to serve websites.
first is /var/www/html/wordpressone & second is /var/www/html/wordpresstwo. Now i able to access these to sites using below url
http://192.168.0.1/wordpressone -> /var/www/html/wordpressone
http://192.168.0.1/wordpresstwo -> /var/www/html/wordpresstwo
Now i want define a custom url eg.
http://192.168.0.1/admin -> /var/www/html/wordpressone
http://192.168.0.1/user -> /var/www/html/wordpresstwo
But i am not able to do it using Vhost. I tried below method but did not work.
I created a file home.conf under /etc/apache2/sites-available & enabled it.
<VirtualHost *:80>
ServerName http://192.168.0.1/user
DocumentRoot /var/www/html/wordpressone
<Directory />
Please tell me what are steps i need to perform to achieve this ?
All Depends on Document Root. It Navigates you to the given folder Just Make two host one with
http://192.168.0.1/admin
with the configuration inside
<VirtualHost *:80>
ServerName http://192.168.0.1/admin
DocumentRoot /var/www/html/wordpressone
<Directory />
and another with
http://192.168.0.1/user
with the configuration inside
<VirtualHost *:80>
ServerName http://192.168.0.1/user
DocumentRoot /var/www/html/wordpresstwo
<Directory />
I have created a virtual host for a drupal website on Windows 10 using Bitnami (WAMPstack),
and when start the website , i can access to the home page only but not to sub pages or sub-directories.
in the windows etc folder i did update the hosts file and added
127.0.0.1 website.local
also edited the httpd.conf enabled the virtual host
(Include conf/extra/httpd-vhosts.conf)
also edited the httpd-vhosts file : added the follwoing
<Directory C:/vhosts>
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot "C:/Bitnami/wampstack-7.1.15-0/apache2/htdocs/website/"
ServerName website.local
</VirtualHost>
when i start browsing the site and click on any subpage i got a 404 (Not Found)
please advise.
Seems like you are missing some directives on the directory level. Here is a config that works that basically follows https://www.drupal.org/node/953296#comment-9866119
<VirtualHost *:80>
DocumentRoot /home/myrepo/mydocroot
ServerName mysite.localhost
<Directory /home/myrepo/mydocroot >
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
You might need to activate the mod_rewrite in apache.
Edit the httpd.conf and search for "#LoadModule rewrite_module modules/mod_rewrite.so" remove the "#". Save and restart the apache.
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/
I installed genymotion emulator on my PC and I want to access my WAMP local server to it and I ran ipconfig on my cmd so I got this IP_address 192.168.56.1 but the problem is that I always get this error
403 Forbidden
You don't have permission to access / on this server
I tried all the answers given in this question yet none solved my problem.
I am running
Mysql 5.5.8,
PHP 5.3.5 and
Apache 2.2.17
Please do anyone know how I can fix this error?
#KANAYOAUSTINKANE. This is my code or the Subdomain
<Virtualhost *:80>
DocumentRoot "C:/wamp/www/mobile"
ServerName localhost
ServerAlias m.local host
</Virtualhost>
Please help me out, I have been so disturbed
Okay, here is a solution.
First step
Change the location of your virtual host and add a / at the end like this
DocumentRoot "C:/wamp/www/mobile/"
Second step
Go to your httpd.conf file located at C:/camp/bin/apache/Apache2.2.17/conf/httpd.conf the go to the line that has Listen 80 and change it to Listen *:80 this will make it to listen to any IP address
Finally
You go to the end of your httpd.conf file and add this
# Tells Apache to identify which site by name
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wamp/www"
</VirtualHost>
# Tells Apache to serve your mobile pages to "m.localhost"
<VirtualHost 127.0.0.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
Allow from all
Order Allow,Deny
AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
DirectoryIndex index.html index.php
</VirtualHost>
#Here you duplicate the code for your mobile site to also accept your IP address which is 192.168.56.1
<VirtualHost 192.168.56.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
Allow from all
Order Allow,Deny
AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
DirectoryIndex index.html index.php
</VirtualHost>
Tested and working. Please don't forget to mark the answer
I'm using WAMPSERVER to run a wordpress site that has to be acessible by the users in my network, like a environment for testing together.
Localhost works fine, but at first i couldn't access the aplication from other computers in the network. I created a rule to open the port 80, created an Alias in the Apache configuration, and it worked but the theme and any images inside subfolders wouldn't load and the console was returning lots of 404 responses.
I want to map the subfolders and its files that are under the 'base dir' of the site. I tried tons of options in the Apache conf. file but i couldn't make it.
Attached a printscreen of the responses, the apache conf file and the windows hosts file
Httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#animamidia
DocumentRoot "C:\wamp\www\website"
ServerName www.animamidia
ErrorLog "logs/animamidia-error.log"
CustomLog "logs/animamidia-access.log" common
<Directory "C:\wamp\www\website\*">
Options FollowSymLinks Includes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Windows hosts file:
127.0.0.1 www.animamidia
The site with it's theme broken because the requisition returned a 404
Well i found the problem.
Even though i couldn't enter the wordpress-admin i decided to check the 'wp-config.php' file just in case something is wrong or missing.
And what i did find is that the 'Home-URL' and the 'WP-URL' were set at 'localhost/website' which means that all the requisitions would point at this location as a base directory.
All i had to do was to use the 'define' comand and set the site's URL to the machine's IP and now the environment is all set up for the guys over here to develop and test their stuff.